mirror of
https://github.com/acamarata/moment-hijri-plus.git
synced 2026-07-01 03:04:32 +00:00
1.1 KiB
1.1 KiB
moment-hijri-plus / default
Function: default()
default(
momentInstance):void
Defined in: src/index.ts:150
Install the Hijri plugin into the provided Moment.js instance.
Mutates momentInstance.fn to add instance methods (toHijri, hijriYear,
hijriMonth, hijriDay, isValidHijri, formatHijri) and attaches
momentInstance.fromHijri as a static factory. Call once at application startup.
The call is idempotent: calling it a second time overwrites the methods with identical implementations.
Parameters
momentInstance
__module
The Moment.js constructor to augment. Pass your imported
moment directly. Works with any moment instance, including locale-scoped ones.
Returns
void
Example
import moment from 'moment';
import installHijri from 'moment-hijri-plus';
installHijri(moment);
moment(new Date(2023, 2, 23)).toHijri();
// => { hy: 1444, hm: 9, hd: 1 }