Browse files

Added some tests for parse.

  • Loading branch information...
1 parent 32a09e0 commit 4367e5b622256ba374a1201298ecd009f502a3ba @mde committed Mar 6, 2014
Showing with 27 additions and 0 deletions.
  1. +27 −0 test/date.js
View
27 test/date.js
@@ -52,6 +52,33 @@ tests = {
assert.equal(actual, data);
}
+, 'test parse UTC': function () {
+ var dt = date.parse('1970-01-01T00:00:00Z');
+ assert.equal(0, dt.getTime());
+ }
+
+, 'test parse with offset basic': function () {
+ var dt;
+ dt = date.parse('1970-01-01T00:00:00-0100');
+ assert.equal(3600000, dt.getTime());
+ dt = date.parse('1970-01-01T00:00:00+0100');
+ assert.equal(-3600000, dt.getTime());
+ }
+
+, 'test parse with offset extended': function () {
+ var dt;
+ dt = date.parse('1970-01-01T00:00:00-01:00');
+ assert.equal(3600000, dt.getTime());
+ dt = date.parse('1970-01-01T00:00:00+01:00');
+ assert.equal(-3600000, dt.getTime());
+ }
+
+, 'test parse floating (i.e., local offset)': function () {
+ var dt;
+ dt = date.parse('1970-01-01T00:00:00');
+ assert.equal(dt.getTime() / 1000 / 60, dt.getTimezoneOffset());
+ }
+
};
module.exports = tests;

0 comments on commit 4367e5b

Please sign in to comment.