SaeedDev94 / ng-persian-datepicker

Persian datepicker for angular 17+
MIT License
86 stars 19 forks source link

dateIsGregorian not working #53

Closed mhgivechi closed 5 months ago

mhgivechi commented 2 years ago

Hi, thank you very much for your good library. DateIsGregorian does not work.

SaeedDev94 commented 2 years ago

Hi [dateIsGregorian] is a simple flag that indicate value of date provided by FormControl is gregorian or not. With that, the lib can convert gregorian date to shamsi correctly. If it's not working as i told, please provide a example with https://stackblitz.com/

mhgivechi commented 2 years ago

Hi [dateIsGregorian] is a simple flag that indicate value of date provided by FormControl is gregorian or not. With that, the lib can convert gregorian date to shamsi correctly. If it's not working as i told, please provide a example with https://stackblitz.com/

Thank you, I thought this property would turn the calendar into a Gregorian calendar.There is a way to do this?

SaeedDev94 commented 2 years ago

Thank you, I thought this property would turn the calendar into a Gregorian calendar.There is a way to do this?

Your welcome! The lib doesn't design to be a gregorian calendar, so the answer is NO.

mehrdaddjb commented 2 years ago

hi first of all thanks for awesome component then i set [dateIsGregorian] to true but when submit the form the filed value is still hijrii

<ng-persian-datepicker (dateOnSelect)="onSelect($event,formItem.fieldName)" *ngSwitchCase="'datetime'" [timeShowSecond]="false" [dateIsGregorian]="true" [timeMeridian]="false"> <input type="text" [formControlName]="formItem.fieldName" [ngClass]="formItem.class||'form-control'"/> </ng-persian-datepicker>

what have I done wrong?

SaeedDev94 commented 2 years ago

hi first of all thanks for awesome component then i set [dateIsGregorian] to true but when submit the form the filed value is still hijrii

<ng-persian-datepicker (dateOnSelect)="onSelect($event,formItem.fieldName)" *ngSwitchCase="'datetime'" [timeShowSecond]="false" [dateIsGregorian]="true" [timeMeridian]="false"> <input type="text" [formControlName]="formItem.fieldName" [ngClass]="formItem.class||'form-control'"/> </ng-persian-datepicker>

what have I done wrong?

@mehrdaddjb To getting gregorian value please checkout $event: IActiveDate provided by [ (dateOnInit), (dateOnSelect)] events, As i said before:

[dateIsGregorian] is a simple flag that indicate value of date provided by FormControl is gregorian or not. With that, the lib can convert gregorian date to shamsi correctly.

So you don't need [dateIsGregorian]="true" if your init date value is shamsi or you don't have init value at all.

SaeedDev94 commented 5 months ago

Gregorian calendar added in v8.0.0 !!