ソースを参照

slight fix for stripTime when using moment-timezone

Adam Shaw 11 年 前
コミット
4bdc2fdbda
1 ファイル変更5 行追加3 行削除
  1. 5 3
      src/moment-ext.js

+ 5 - 3
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
 };