Skip to content

Commit a8a2d5b

Browse files
authored
Merge branch 'main' into simplify-get-timezone-offset
2 parents 24b23c8 + 2de95b6 commit a8a2d5b

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

parse.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ export class IsoDateParts {
88
static getTimezoneOffset(offset = "Z") {
99
let [, hours = "0", minutes = "0"] = offset.match(this.TIMEZONE_REGEX) ?? [];
1010

11+
let sign = hours[0] === '-' ? -1 : 1;
1112
return {
1213
hours: parseInt(hours, 10),
13-
minutes: parseInt(minutes, 10)
14+
minutes: parseInt(minutes, 10) * sign
1415
};
1516
}
1617

test/utils.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ export const VALID_TEST_CASES = `
2525
2016-05-25T09+01:00
2626
2016-05-25T09:24+01:00
2727
2016-05-25T09:24:15+01:00
28+
2016-05-25T09:24:15+01:15
2829
2016-05-25T09:24:15.123+01:00
2930
2016-05-25T09:24:15,123+01:00
3031
2016-05-25T09-01:00
3132
2016-05-25T09:24-01:00
3233
2016-05-25T09:24:15-01:00
34+
2016-05-25T09:24:15-01:15
3335
2016-05-25T09:24:15.123-01:00
3436
2016-05-25T09:24:15,123-01:00
3537
2016-05-25T09+06:00
@@ -73,8 +75,10 @@ export const VALID_TEST_CASES = `
7375
// Issue #1
7476
2016-05-25T09:24:15+06
7577
2016-05-25T09:24:15+0600
78+
2016-05-25T09:24:15+0615
7679
2016-05-25T09:24:15-06
7780
2016-05-25T09:24:15-0600
81+
2016-05-25T09:24:15-0615
7882
7983
// 6 digit years
8084
+002000-01-01

0 commit comments

Comments
 (0)