]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
test for issue #3132 - TODO: less issue specific
authorG1NA <p3130052@dias.aueb.gr>
Tue, 23 May 2017 09:58:18 +0000 (12:58 +0300)
committerIskren Chernev <iskren.chernev@gmail.com>
Sun, 6 Aug 2017 23:41:44 +0000 (02:41 +0300)
src/test/moment/start_end_of.js

index 519c7641ee4c88aef685cea4e160d73ee1620cdd..2efa5c06593bcb7e9066b9b8a046ead916b63eb7 100644 (file)
@@ -189,6 +189,22 @@ test('end of day', function (assert) {
     assert.equal(m.milliseconds(), 999, 'set the seconds');
 });
 
+test('end of day - testing issue #3132', function (assert) {
+    var d = moment.tz("2016-10-16","America/Sao_Paulo");
+    var m = d.endOf('day').format("YYYY-MM-DD HH:mm:ss"),
+        ms = d.endOf('days').format("YYYY-MM-DD HH:mm:ss"),
+        ma = d.endOf('d').format("YYYY-MM-DD HH:mm:ss");
+    assert.equal(+m, +ms, 'Plural or singular should work');
+    assert.equal(+m, +ma, 'Full or abbreviated should work');
+    assert.equal(m.year(), 2016, 'keep the year');
+    assert.equal(m.month(), 10, 'keep the month');
+    assert.equal(m.date(), 16, 'keep the day');
+    assert.equal(m.hours(), 23, 'set the hours');
+    assert.equal(m.minutes(), 59, 'set the minutes');
+    assert.equal(m.seconds(), 59, 'set the seconds');
+    assert.equal(m.milliseconds(), 999, 'set the seconds');
+});
+
 test('start of date', function (assert) {
     var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).startOf('date'),
         ms = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).startOf('dates');