From c95c230d0f7035bcf38e5fdb166a56c35e283c73 Mon Sep 17 00:00:00 2001 From: G1NA Date: Tue, 23 May 2017 13:08:44 +0300 Subject: [PATCH] test for issue #3132 - TODO: make it less issue specific --- src/test/moment/start_end_of.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/test/moment/start_end_of.js b/src/test/moment/start_end_of.js index 519c7641ee..2efa5c0659 100644 --- a/src/test/moment/start_end_of.js +++ b/src/test/moment/start_end_of.js @@ -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');