diff --git a/parse.js b/parse.js index c0976c9..b44de39 100644 --- a/parse.js +++ b/parse.js @@ -20,9 +20,10 @@ export class IsoDateParts { } let [hours, minutes] = [match[1], match[2]]; + let sign = hours[0] === '-' ? -1 : 1; return { hours: parseInt(hours, 10) || 0, - minutes: parseInt(minutes, 10) || 0 + minutes: (parseInt(minutes, 10) || 0) * sign }; } diff --git a/test/utils.js b/test/utils.js index 37b564e..8bdaf95 100644 --- a/test/utils.js +++ b/test/utils.js @@ -25,11 +25,13 @@ export const VALID_TEST_CASES = ` 2016-05-25T09+01:00 2016-05-25T09:24+01:00 2016-05-25T09:24:15+01:00 +2016-05-25T09:24:15+01:15 2016-05-25T09:24:15.123+01:00 2016-05-25T09:24:15,123+01:00 2016-05-25T09-01:00 2016-05-25T09:24-01:00 2016-05-25T09:24:15-01:00 +2016-05-25T09:24:15-01:15 2016-05-25T09:24:15.123-01:00 2016-05-25T09:24:15,123-01:00 2016-05-25T09+06:00 @@ -73,8 +75,10 @@ export const VALID_TEST_CASES = ` // Issue #1 2016-05-25T09:24:15+06 2016-05-25T09:24:15+0600 +2016-05-25T09:24:15+0615 2016-05-25T09:24:15-06 2016-05-25T09:24:15-0600 +2016-05-25T09:24:15-0615 // 6 digit years +002000-01-01