You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello friends Does anyone have a sample adapter file for Jalali calendar (Persian) or Hijri calendar (Islamic)? If possible, put it here for me I have some samples but it doesn't work properly I use matdatepicker and version 17 of Angular
The text was updated successfully, but these errors were encountered:
import{DateTime}from'luxon';exportinterfaceJalaliDate{year: number;month: number;day: number;}/** * Converts a date to Jalali date. * * @param date - The date to convert, as a `DateTime` or `Date`. * @returns The Jalali date representation of the input date. * * @example * toJalali(new Date('2025-01-25')); * // => { year: 1403, month: 11, day: 6 } */exportfunctiontoJalali(date: DateTime|Date): JalaliDate{constdt=(dateinstanceofDate ? DateTime.fromJSDate(date) : date).setLocale('fa-IR').toLocaleParts();functionfromPersian(num: string): number{returnNumber(num.replace(/[۰-۹]/g,(d)=>'۰۱۲۳۴۵۶۷۸۹'.indexOf(d).toString()));}constyear=dt.find((d)=>d.type==='year')!.value;constmonth=dt.find((d)=>d.type==='month')!.value;constday=dt.find((d)=>d.type==='day')!.value;return{year: fromPersian(year),month: fromPersian(month),day: fromPersian(day),};}
Hello friends Does anyone have a sample adapter file for Jalali calendar (Persian) or Hijri calendar (Islamic)? If possible, put it here for me I have some samples but it doesn't work properly I use matdatepicker and version 17 of Angular
The text was updated successfully, but these errors were encountered: