diff --git a/package-lock.json b/package-lock.json index 3300ebaa7..afd945fd6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4565,12 +4565,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -4585,17 +4587,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -4712,7 +4717,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -4724,6 +4730,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -4738,6 +4745,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -4745,12 +4753,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.2.4", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -4769,6 +4779,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -4849,7 +4860,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -4861,6 +4873,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -4982,6 +4995,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -10592,9 +10606,9 @@ } }, "timezone-support": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/timezone-support/-/timezone-support-1.2.1.tgz", - "integrity": "sha512-g37KFEiVBC997ORvRFpnDFWXYHPIXRetNKMChfaoCRDYT+xVbrpvDkpmoIFY4m1pgq5DbpknHj7o0yWtpUd01g==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/timezone-support/-/timezone-support-1.3.0.tgz", + "integrity": "sha512-3bajL+s+Lct+tYt4k0d5MpTgknIVkC6ETfs/d+kkxYjIz+KUhXGU+x3Jlg8K20JoHWpuMd3dBH4mmjC7Z/MvQQ==", "dev": true }, "tmp": { diff --git a/package.json b/package.json index 44190d9be..f42c8fdde 100644 --- a/package.json +++ b/package.json @@ -166,7 +166,7 @@ "rollup-plugin-babel": "^4.0.3", "rollup-plugin-uglify": "^6.0.0", "size-limit": "^0.20.0", - "timezone-support": "^1.2.1", + "timezone-support": "^1.3.0", "typescript": "^3.0.3" }, "dependencies": {} diff --git a/src/plugin/timeZone/index.js b/src/plugin/timeZone/index.js index 4687a2217..4aaff8e6a 100644 --- a/src/plugin/timeZone/index.js +++ b/src/plugin/timeZone/index.js @@ -2,7 +2,7 @@ import { findTimeZone, setTimeZone, getZonedTime } from 'timezone-support' import { FORMAT_DEFAULT } from '../../constant' function updateTime(instance, { - year, month, day, hours, minutes, epoch, zone + year, month, day, dayOfWeek, hours, minutes, epoch, zone }, convertTimeZone) { const date = instance.$d // Update the Date object with the epoch time from the date @@ -14,6 +14,7 @@ function updateTime(instance, { instance.$Y = year instance.$M = month - 1 instance.$D = day + instance.$W = dayOfWeek instance.$H = hours instance.$m = minutes const { abbreviation, offset } = zone @@ -25,6 +26,7 @@ function updateTime(instance, { instance.$Y = date.getFullYear() instance.$M = date.getMonth() instance.$D = date.getDate() + instance.$W = date.getDay() instance.$H = date.getHours() instance.$m = date.getMinutes() } diff --git a/test/plugin/timeZone.test.js b/test/plugin/timeZone.test.js index 0684f3ac0..0cd3c0cf7 100644 --- a/test/plugin/timeZone.test.js +++ b/test/plugin/timeZone.test.js @@ -29,9 +29,9 @@ it('Fail constructing with an invalid time zone', () => { it('Format date converted to other time zone', () => { const input = '2018-09-02T21:01:22Z' - const format = 'D.M YYYY H:mm:ss [GMT]ZZ (z)' + const format = 'd, D.M YYYY H:mm:ss [GMT]ZZ (z)' const timeZone = 'Europe/Berlin' - const output = '2.9 2018 23:01:22 GMT+0200 (CEST)' + const output = '0, 2.9 2018 23:01:22 GMT+0200 (CEST)' expect(dayjs(input).format(format, { timeZone })).toEqual(output) expect(moment(input).tz(timeZone).format(format)).toEqual(output) })