Closed Bilal-io closed 3 months ago
The issue is likely with your version of Chrome for Android. You can try this:
new Intl.DateTimeFormat("en-u-ca-islamic", { month: "long" }).format() // => 'Ramadan'
I suspect that in your version of Chrome for Android, you'll get "September" there. These strings are provided by ICU and are part of the platform; Luxon uses the Intl API to access them, and can't change them. I recommend that you update Chrome, and/or file a ticket with them, using the code above as an example.
As for DateTime.local({ outputCalendar: 'islamic' }).month
that is expected; the outputCalendar
only affects formatted strings, while the month
accessor always supplies the month from the Gregorian calendar. That is documented here
You're absolutely right, thank you. Closing.
Describe the bug Islamic calendar return Gregorian month on Chrome Android when using toFormat('dd MMMM, yyyy')
To Reproduce
DateTime.local({ outputCalendar: 'islamic' }).toFormat('dd MMMM, yyyy')
Actual vs Expected behavior
Actual = "04 September, 1445"
Expected = "04 Ramadan, 1445"
Note Ramadan is the 9th month in the Hijri calendarNot sure if related, but this also produces wrong output
DateTime.local({ outputCalendar: 'islamic' }).month
Actual = 3
Expected = 9
Desktop (please complete the following information):
Additional context Add any other context about the problem here.