]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Make suggested fix by @vagsa2
authorKunal Marwaha <marwahaha@berkeley.edu>
Tue, 21 Feb 2017 07:33:51 +0000 (02:33 -0500)
committerIskren Chernev <iskren.chernev@gmail.com>
Sat, 11 Mar 2017 22:35:29 +0000 (00:35 +0200)
src/test/moment/format.js

index 25ea64ba411f7b60a8714bca3cc33710d14c71d3..195469a7807773f7fc55beb0699e4eae8d3f1d49 100644 (file)
@@ -215,6 +215,13 @@ test('long years', function (assert) {
     assert.equal(moment.utc().year(-20123).format('YYYYYY'), '-020123', 'big negative year with YYYYYY');
 });
 
+test('toISOString() when 0 year', function (assert) {
+    // https://github.com/moment/moment/issues/3765
+    var date = moment('0000-01-01T21:00:00.000Z');
+    assert.equal(date.toISOString(), '0000-01-01T21:00:00.000Z');
+    assert.equal(date.toDate().toISOString(), '0000-01-01T21:00:00.000Z');
+});
+
 test('iso week formats', function (assert) {
     // https://en.wikipedia.org/wiki/ISO_week_date
     var cases = {