From 4bdc2fdbdaab3073f3014c127573d8278114f453 Mon Sep 17 00:00:00 2001 From: Adam Shaw Date: Fri, 13 Jun 2014 16:53:01 -0700 Subject: [PATCH] slight fix for stripTime when using moment-timezone --- src/moment-ext.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/moment-ext.js b/src/moment-ext.js index 39cec43..3afd911 100644 --- a/src/moment-ext.js +++ b/src/moment-ext.js @@ -176,9 +176,6 @@ FCMoment.prototype.stripTime = function() { // set the internal UTC flag moment.fn.utc.call(this); // call the original method, because we don't want to affect _ambigZone - this._ambigTime = true; - this._ambigZone = true; // if ambiguous time, also ambiguous timezone offset - this.year(a[0]) // TODO: find a way to do this in one shot .month(a[1]) .date(a[2]) @@ -187,6 +184,11 @@ FCMoment.prototype.stripTime = function() { .seconds(0) .milliseconds(0); + // Mark the time as ambiguous. This needs to happen after the .utc() call, which calls .zone(), which + // clears all ambig flags. Same concept with the .year/month/date calls in the case of moment-timezone. + this._ambigTime = true; + this._ambigZone = true; // if ambiguous time, also ambiguous timezone offset + return this; // for chaining };