From c9e83cab95489bd50a586bbf87dd2a8a9485d30a Mon Sep 17 00:00:00 2001 From: Ali Mohammadi Date: Fri, 31 Jan 2020 16:16:47 +0330 Subject: [PATCH] fix(utc): add utc property to wrapper --- src/plugin.js | 1 + test/plugin.utc.test.js | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 test/plugin.utc.test.js diff --git a/src/plugin.js b/src/plugin.js index 204f10b..d20ac46 100644 --- a/src/plugin.js +++ b/src/plugin.js @@ -66,6 +66,7 @@ export default (o, Dayjs, dayjs) => { const wrapper = function (date, instance) { return dayjs(date, { locale: instance.$L, + utc: instance.$u, calendar: instance.$C }) } diff --git a/test/plugin.utc.test.js b/test/plugin.utc.test.js new file mode 100644 index 0000000..cfa92d2 --- /dev/null +++ b/test/plugin.utc.test.js @@ -0,0 +1,12 @@ +import dayjs from 'dayjs' +import utc from 'dayjs/plugin/utc' +import jalali from '../src' + +dayjs.extend(utc) +dayjs.extend(jalali) + +it('Should respect utc', () => { + const date = dayjs.utc().calendar('jalali') + + expect(date.isUTC()).toBe(true) +})