From: Iskren Chernev Date: Sat, 10 May 2014 16:18:12 +0000 (-0700) Subject: Add tests X-Git-Tag: 2.7.0~8^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f7b21b15e49ec40672be407729638550c6609a9f;p=thirdparty%2Fmoment.git Add tests --- diff --git a/test/moment/create.js b/test/moment/create.js index a96f016e9..9947d4856 100644 --- a/test/moment/create.js +++ b/test/moment/create.js @@ -348,6 +348,16 @@ exports.create = { test.done(); }, + "string with timezone around start of year" : function (test) { + test.equal(moment('2000-01-01T00:00:00.000+01:00').toISOString(), "1999-12-31T23:00:00.000Z", "+1:00 around 2000"); + test.equal(moment('2000-01-01T00:00:00.000-01:00').toISOString(), "2000-01-01T01:00:00.000Z", "-1:00 around 2000"); + test.equal(moment('1970-01-01T00:00:00.000+01:00').toISOString(), "1969-12-31T23:00:00.000Z", "+1:00 around 1970"); + test.equal(moment('1970-01-01T00:00:00.000-01:00').toISOString(), "1970-01-01T01:00:00.000Z", "-1:00 around 1970"); + test.equal(moment('1200-01-01T00:00:00.000+01:00').toISOString(), "1199-12-31T23:00:00.000Z", "+1:00 around 1200"); + test.equal(moment('1200-01-01T00:00:00.000-01:00').toISOString(), "1200-01-01T01:00:00.000Z", "-1:00 around 1200"); + test.done(); + }, + "string with array of formats" : function (test) { test.equal(moment('11-02-1999', ['MM-DD-YYYY', 'DD-MM-YYYY']).format('MM DD YYYY'), '11 02 1999', 'switching month and day');