A Hijri (Based on Umm al-Qura calculations) calendar system plugin for moment.js.
Hijri is the Islamic lunar calendar used by Muslims to determine the proper days on which to observe the annual fasting, to attend Hajj, and to celebrate other Islamic holidays and festivals. More information about Hijri can be found at wikipedia.
This plugin adds Hijri calendar support to momentjs library.
Calendar conversion is based on the Umm al-Qura calculations.
Upgrading to 2.0.0
Because of Using 'h' specifier might cause overlap with hour's specifier, the specifier has been changed from
i as a prefix. For example in the previous version to get the four digit year,
hYYYY will be used. In version 2.0 or above it should be replaced by
Where to use it?
moment-hijri works in browser and in Node.js.
npm install moment-hijri
var moment = ;;
This plugin tries to mimic
momentjs api. Basically, when formatting or parsing a string, add an
i to the format token such as 'iYYYY' or 'iM'. For example:
m = ; // Parse a Hijri date.m; // 1410/8/28 is 1990/3/25m; // 1410m; // 7m; // 28m; // 236m; // 35m; // 1410m;m;m; // 1411/10/28m;m;m; // 1411/12/1m;m;m; // 1420/1/1; // false (This month is only 29 days).; // true (This month is 30 days).; // 2014-11-28 16:40:00; // 1436/2/30 23:59:59// Complex parse:; // 1990/03/25
To use the Arabic locale:
Here is example:
<!-- 1- Load the moment-with-locales -->