jalaliday icon indicating copy to clipboard operation
jalaliday copied to clipboard

Wrong list of months

Open mokhosh opened this issue 1 year ago • 0 comments

Currently what you get out of months() method is dependant on locale which is wrong. It should depend on calendar, and locale should only define the language:

dayjs.locale('fa')
console.log(dayjs.calendar('jalali').months())
// outputs: ['فروردین', 'اردیبهشت', 'خرداد', 'تیر', 'مرداد', 'شهریور', 'مهر', 'آبان', 'آذر', 'دی', 'بهمن', 'اسفند']
// Correct!
console.log(dayjs.months())
// outputs: ['فروردین', 'اردیبهشت', 'خرداد', 'تیر', 'مرداد', 'شهریور', 'مهر', 'آبان', 'آذر', 'دی', 'بهمن', 'اسفند']
// Wrong! It should be ژانویه فوریه مارچ etc.

dayjs.locale('en')
console.log(dayjs.calendar('jalali').months())
// outputs: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
// Wrong! It should be Farvardin, Ordibehesht, etc.
console.log(dayjs.months())
// outputs: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
// Correct!

mokhosh avatar Jul 24 '23 11:07 mokhosh