From: kostas Date: Tue, 9 May 2017 08:51:55 +0000 (+0300) Subject: Revert: - Fixing issue #3132 X-Git-Tag: 2.19.0~14^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=40dafd394f1c3b3407fb2f9d897cadd90487245f;p=thirdparty%2Fmoment.git Revert: - Fixing issue #3132 --- diff --git a/src/lib/moment/start-end-of.js b/src/lib/moment/start-end-of.js index 36674ccc5..02f982479 100644 --- a/src/lib/moment/start-end-of.js +++ b/src/lib/moment/start-end-of.js @@ -1,29 +1,29 @@ -import {normalizeUnits} from '../units/aliases'; +import { normalizeUnits } from '../units/aliases'; -export function startOf(units) { +export function startOf (units) { units = normalizeUnits(units); // the following switch intentionally omits break keywords // to utilize falling through the cases. switch (units) { case 'year': this.month(0); - /* falls through */ + /* falls through */ case 'quarter': case 'month': this.date(1); - /* falls through */ + /* falls through */ case 'week': case 'isoWeek': case 'day': case 'date': this.hours(0); - /* falls through */ + /* falls through */ case 'hour': this.minutes(0); - /* falls through */ + /* falls through */ case 'minute': this.seconds(0); - /* falls through */ + /* falls through */ case 'second': this.milliseconds(0); } @@ -44,7 +44,7 @@ export function startOf(units) { return this; } -export function endOf(units) { +export function endOf (units) { units = normalizeUnits(units); if (units === undefined || units === 'millisecond') { return this; @@ -55,15 +55,5 @@ export function endOf(units) { units = 'day'; } - switch (units) { - case 'day': - var endOfDay = this.startOf(units).add(1, units).subtract(1, 'ms'); - endOfDay.hours(23); - endOfDay.minutes(59); - endOfDay.seconds(59); - endOfDay.milliseconds(999); - return endOfDay; - default: - return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms'); - } + return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms'); }