Skip to content

Commit d5da19d

Browse files
andrew-colemanmattbaileyuk
authored andcommitted
fix test suite to work in all timezones
Signed-off-by: andrew-coleman <andrew_coleman@uk.ibm.com>
1 parent 9be182a commit d5da19d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/datetime.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ const dateTime = (function () {
644644
// the week starts on a Monday - calculate the millis for the start of the first week
645645
// millis for given 1st Jan of that year (at 00:00 UTC)
646646
const jan1 = Date.UTC(ym.year, ym.month);
647-
var dayOfJan1 = (new Date(jan1)).getDay();
647+
var dayOfJan1 = (new Date(jan1)).getUTCDay();
648648
if (dayOfJan1 === 0) {
649649
dayOfJan1 = 7;
650650
}
@@ -1207,8 +1207,8 @@ const dateTime = (function () {
12071207
const firstJan = Date.UTC(components.Y, 0);
12081208
const offsetMillis = (components.d - 1) * 1000 * 60 * 60 * 24;
12091209
const derivedDate = new Date(firstJan + offsetMillis);
1210-
components.M = derivedDate.getMonth();
1211-
components.D = derivedDate.getDate();
1210+
components.M = derivedDate.getUTCMonth();
1211+
components.D = derivedDate.getUTCDate();
12121212
}
12131213
if (dateC) {
12141214
// TODO implement this

0 commit comments

Comments
 (0)