ng-gregorian-hijri-datepicker
Version:
* Lightweight **Angular** datepicker based on [ng-bootstrap](https://ng-bootstrap.github.io/#/components/datepicker/overview) that supports **Gregorian** and **Hijri** calendars. * Provides ability to swap between **Gregorian** and **Hijri** calendars *
52 lines (44 loc) • 2.5 kB
HTML
<div class="form-group" provideParentForm>
<label class="requiredInput" *ngIf="showLabel" for="input-birth-Date">{{ label }} </label>
<div class="input-group">
<input class="form-control"
[]="placeHolder ? placeHolder : 'd/M/yyyy'"
[]="label"
*ngIf="selectedDateType == DateType.Gregorian"
[(ngModel)]="selectedDate"
ngbDatepicker (click)="d.toggle()"
(dateSelect)="dateSelected()"
autocomplete="off"
[]="readonly"
[]="minGreg"
[]="maxGreg"
[]="isRequired"
[]="disabled"
[]="footerTemplate"
<ng-template
<hr class="my-0">
<button class="btn btn-secondary btn-sm m-2 float-right" type="button" (click)="close()">Close</button>
<button class="btn btn-primary btn-sm m-2 float-left" type="button" (click)="clear()">Clear</button>
</ng-template>
<hijri-date-picker *ngIf="selectedDateType == DateType.Hijri"
[(selectedDate)]="selectedDate"
(selectedDateChange)="dateSelected()"
[]="readonly"
[]="minHijri" [max]="maxHijri"
style="position: relative;flex: 1 1 auto;width: 1%; min-width: 0;margin-bottom: 0;"
[]="label"
[]="isRequired"
[]="placeHolder"
[]="disabled">
</hijri-date-picker>
<div class="input-group-append">
<button class="btn btn-sm {{selectedDateType == DateType.Hijri ? 'btn-info focus active' : 'btn-outline-info'}}" (click)="hijriClick()" [disabled]="disabled" type="button">
{{hijriLabel ? hijriLabel : 'Hijri' }}
</button>
<button class="btn btn-sm {{selectedDateType == DateType.Gregorian ? 'btn-info focus active' : 'btn-outline-info'}}" (click)="gregClick()" [disabled]="disabled" type="button">
{{GregLabel ? GregLabel : 'Gregorian' }}
</button>
</div>
</div>
</div>