diff --git a/src/plugin.js b/src/plugin.js index bba4ff9..03f4764 100644 --- a/src/plugin.js +++ b/src/plugin.js @@ -60,6 +60,10 @@ export default (o, Dayjs, dayjs) => { return that; }; + dayjs.isJalali = function () { + return $isJalali(this); + }; + proto.isJalali = function () { return $isJalali(this); }; diff --git a/test/plugin.test.js b/test/plugin.test.js index 3ece226..b1ae5e5 100644 --- a/test/plugin.test.js +++ b/test/plugin.test.js @@ -38,3 +38,11 @@ test('keep instance calendar on manipulation', () => { expect(dayjs(date).add(1, 'month').$C).toEqual('jalali') expect(dayjs(date).add(1, 'month').add(1, 'month').isJalali()).toEqual(true) }) + +test('is jalali', () => { + dayjs.calendar('gregory') + expect(dayjs.isJalali()).toEqual(false) + + dayjs.calendar('jalali') + expect(dayjs.isJalali()).toEqual(true) +})