Skip to content

Commit

Permalink
Merge branch 'master' into development
Browse files Browse the repository at this point in the history
fix(source): Fix #65: Error: Hour 0 must be between 1 and 23 inclusive.
  • Loading branch information
Therapon Skoteiniotis committed Jul 6, 2017
2 parents c51a351 + b86026f commit fbc399c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/IonTimestamp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const MIN_SECONDS: number = 0;
const MAX_SECONDS: number = 60;
const MIN_MINUTE: number = 0;
const MAX_MINUTE: number = 59;
const MIN_HOUR: number = 1;
const MIN_HOUR: number = 0;
const MAX_HOUR: number = 23;
const MIN_DAY: number = 1;
const MAX_DAY: number = 31;
Expand Down
15 changes: 13 additions & 2 deletions tests/unit/IonTimestampTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,22 @@
}
};

parseTest('Parses year', '2017T');
parseTest('Parses month', '2017-02T');
parseTest('Parses year: Years precision, unknown local offset', '2017T');
parseTest('Parses month: The same instant, with months precision, unknown local offset', '2017-02T');
parseTest('Parses date: The same instant, with different syntax', '2017-02-01T');
parseTest('Parses date: The same instant, with days precision, unknown local offset', '2017-02-01');
// Seconds are optional, but local offset is not.
parseTest('Parses date and time with only hour and minutes', '2007-02-23T12:14Z');
parseTest('Parses date and time with only hour and minutes where hour is 0', '2007-02-23T00:14Z');
parseTest('Parses timestamp: The same instant in UTC ("zero" or "zulu")', '2017-05-01T01:00:00.000Z');
parseTest('Parses timestamp: The same instant in UTC ("zero" or "zulu") and `0` hour', '2017-05-01T00:00:00.000Z');
parseTest('Parses timestamp: A timestamp with millisecond precision and PST local time', '2007-02-23T12:14:33.079-08:00');
parseTest('Parses timestamp: A timestamp with millisecond precision and PST local time where hour is 0', '2007-02-23T00:14:33.079-08:00');
parseTest('Parses timestamp: The same instant, with explicit local offset', '2007-02-23T20:14:33.079+00:00');
parseTest('Parses timestamp: The same instant, with explicit local offset where hour is 0', '2007-02-23T00:14:33.079+00:00');
parseTest('Parses timestamp: The same instant, with unknown local offset', '2007-02-23T20:14:33.079-00:00');
parseTest('Parses timestamp: The same instant, with unknown local offset where hour is 0', '2007-02-23T00:14:33.079-00:00');
parseTest('Parses timestamp: Happy New Year in UTC, unknown local offset', '2007-01-01T00:00-00:00');

registerSuite(suite);
}
Expand Down

0 comments on commit fbc399c

Please sign in to comment.