fix(dates): enforce standard Iranian calendar dates for default values and monthly range
This commit is contained in:
@@ -35,7 +35,7 @@ export function usePersianDate() {
|
||||
const toJalaliPickerValue = (value) => {
|
||||
if (!value) return '';
|
||||
try {
|
||||
return moment(value).locale('fa').format('jYYYY/jMM/jDD');
|
||||
return toLatinDigits(moment(value).locale('fa').format('jYYYY/jMM/jDD'));
|
||||
} catch (e) {
|
||||
return '';
|
||||
}
|
||||
@@ -56,7 +56,11 @@ export function usePersianDate() {
|
||||
const jalaliToIso = (jalaliStr) => toGregorianIso(jalaliStr) || null;
|
||||
|
||||
const getTodayJalali = (formatStr = 'jYYYY/jMM/jDD') => {
|
||||
return moment().locale('fa').format(formatStr);
|
||||
return toLatinDigits(moment().locale('fa').format(formatStr));
|
||||
};
|
||||
|
||||
const getStartOfJalaliMonth = (formatStr = 'jYYYY/jMM/jDD') => {
|
||||
return toLatinDigits(moment().startOf('jMonth').locale('fa').format(formatStr));
|
||||
};
|
||||
|
||||
return {
|
||||
@@ -67,7 +71,9 @@ export function usePersianDate() {
|
||||
toJalaliPickerValue,
|
||||
toGregorianIso,
|
||||
jalaliToIso,
|
||||
getTodayJalali
|
||||
getTodayJalali,
|
||||
getStartOfJalaliMonth
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user