if (this._tzm) {
this.utcOffset(this._tzm);
} else if (typeof this._i === 'string') {
- this.utcOffset(offsetFromString(matchOffset, this._i));
+ var tZone = offsetFromString(matchOffset, this._i);
+
+ if (tZone === 0) {
+ this.utcOffset(0, true);
+ } else {
+ this.utcOffset(offsetFromString(matchOffset, this._i));
+ }
}
return this;
}
assert.equal(moment().zone(+90).format('ZZ'), '-0130', '+90 -> -0130');
assert.equal(moment().zone(+120).format('ZZ'), '-0200', '+120 -> -0200');
});
+
+test('parse zone without a timezone', function (assert) {
+ test.expectedDeprecations();
+ var m = moment.parseZone('2016-02-01T00:00:00');
+ assert.equal(
+ m.format('M D YYYY HH:mm:ss ZZ'),
+ '2 1 2016 00:00:00 +0000',
+ 'Not providing a timezone should keep the time and change the zone to 0'
+ );
+});