ecma402
ecma402 copied to clipboard
Lunar Month support in Intl.DateTimeFormat()
I want to support indian calendar which follow lunar months ; currently it does not support and having no option.
what I am using currently
// Use Intl to get the current Gregorian date in Hindi
const indian = {
weekday: 'long',
year: 'numeric',
month: 'long',
day: '2-digit',
calendar: 'indian', // Indian calendar (though it doesn't give lunar tithi)
timeZone: 'Asia/Kolkata',
numberingSystem: 'deva', // Devanagari numerals
};
const currentDate = new Intl.DateTimeFormat("hi-IN", indian);
but it return date as 16 while in Lunar Month there are 15 days only and there are 2 seprate Paksha name as Shuka and Krishna for more information you can refer hindu calendar wiki page
so my proposal is can we have the support of Lunar calendar?
Hi @xkeshav, as far as I know, the new Temporal API allows you to work with different calendars. You can read more about it here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal. Although it is not yet supported in most browsers, it should be available soon.
calendar: 'indian' is the Indian national calendar. ECMA-402 doesn't currently support Lunar Hindu calendars, although there has been discussion about supporting them in Temporal. For example, see https://github.com/tc39/proposal-intl-era-monthcode/issues/18