Skip to content
This repository was archived by the owner on Apr 14, 2021. It is now read-only.

Commit 00a6b17

Browse files
committed
Add newDateUTC to run the sanity.js on CI
1 parent ec31f6f commit 00a6b17

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tests/sanity.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ function assert(value, expected, message) {
1010
}
1111
}
1212

13+
function newDateUTC() {
14+
var date = new Date(...arguments)
15+
var localTime = date.getTime();
16+
var localOffset = date.getTimezoneOffset() * 60000;
17+
var utc = localTime + localOffset;
18+
return new Date(utc);
19+
}
20+
1321
assert(new IntlPolyfill.NumberFormat('de-DE', {
1422
minimumFractionDigits: 2,
1523
maximumFractionDigits: 2
@@ -30,7 +38,9 @@ assert(new IntlPolyfill.DateTimeFormat('en', {
3038
assert(new IntlPolyfill.DateTimeFormat('en-US', {
3139
hour: 'numeric',
3240
minute: 'numeric'
33-
}).format(new Date('Tue Mar 01 2016 14:08:39 GMT-0500 (EST)')), '2:08 PM', 'missing leading 0 on minutes');
41+
}).format(newDateUTC('Tue Mar 01 2016 14:08:39 GMT-0500 (EST)')), '7:08 PM', 'missing leading 0 on minutes');
42+
43+
// Issue #173
3444
assert(new IntlPolyfill.DateTimeFormat('en-GB', {
3545
hour: '2-digit',
3646
hour12: false,

0 commit comments

Comments
 (0)