Get Today Hijri Date in Javascript

Français Français

To get the current hijri date in javascript, I use Intl.DateTimeFormat

To get the arabic display :

new Intl.DateTimeFormat('ar-FR-u-ca-islamic', {day: 'numeric', month: 'long',weekday: 'long',year : 'numeric'}).format(Date.now());

the expected output :

> "الجمعة، 17 ذو القعدة 1440"

or in french language :

new Intl.DateTimeFormat('fr-FR-u-ca-islamic', {day: 'numeric', month: 'long',weekday: 'long',year : 'numeric'}).format(Date.now());

the expected output :

> "vendredi 17 dhou al qi`da 1440"
or with the islamicc calendar ( with two ‘c’ ) :
new Intl.DateTimeFormat('fr-FR-u-ca-islamicc', {day: 'numeric', month: 'long',weekday: 'long',year : 'numeric'}).format(Date.now());

the expected output :

> "vendredi 16 dhou al qi`da 1440"