I am trying to convert Gregorian to Hijri date using Intl.DateTimeFormat, But every time it converts one day ahead. For example today is 11 Ramadan but every time it results in 12 Ramadan.
I have tried all calendar types "islamic, islamic-umalqura, islamic-civil, islamic-rgsa" I have also tried to change locale "PK, IN, AF, SA" but no difference. Is that a bug or I am doing something wrong.
console.log(new Intl.DateTimeFormat(
'en-PK-u-ca-islamic', {
day: 'numeric',
month: 'long',
weekday: 'long',
year: 'numeric'
}).format(new Date(2024, 2, 22))); // 22 Mar 2024
2
Answers
Try this
Using a dedicated library like date-hijri will be more reliable for your conversion