Search code examples
angular-material2jalali-calendar

How to use jalali calendar in angular material 2?


I use mat-datepicker in my app but when I change the LOCAL_ID to 'fa-IR' the arrangement of months and the days of month is incorrect as seen in this picture:
material datepicker.

how can I do it correctly?
sample link


Solution

  • I reported this bug to angular material and they introduced a repository which solve this problem (as workaround).

    Should rewrite DateAdapter with this one.

     {provide: DateAdapter, useClass: JalaliMomentDateAdapter, deps: 
     [MAT_DATE_LOCALE]},
     {provide: MAT_DATE_FORMATS, useValue: JALALI_MOMENT_FORMATS},
    

    Thanks from peyman ebrahimi for all of his efforts.