return this._isUTC ? "Coordinated Universal Time" : "";
},
+ hasAlignedHours : function (input) {
+ if (input == null || input === '') {
+ return this.zone() % 60 === 0;
+ }
+ else {
+ return this.zone() % 60 === moment(input).zone() % 60;
+ }
+ },
+
daysInMonth : function () {
return moment.utc([this.year(), this.month() + 1, 0]).date();
},
test.equal(moment.utc().format('zz'), "Coordinated Universal Time", "UTC zone formatted abbr should be Coordinated Universal Time");
test.done();
- }
+ },
+
+ "hours alignment with UTC" : function (test) {
+ test.expect(4);
+
+ test.equals(moment().zone(120).hasAlignedHours(), true);
+ test.equals(moment().zone(-180).hasAlignedHours(), true);
+ test.equals(moment().zone(90).hasAlignedHours(), false);
+ test.equals(moment().zone(-90).hasAlignedHours(), false);
+
+ test.done();
+ },
+
+ "hours alignment with other zone" : function (test) {
+ test.expect(4);
+
+ var m = moment().zone(120);
+ test.equals(m.hasAlignedHours(moment().zone(180)), true);
+ test.equals(m.hasAlignedHours(moment().zone(-180)), true);
+ test.equals(m.hasAlignedHours(moment().zone(90)), false);
+ test.equals(m.hasAlignedHours(moment().zone(-90)), false);
+
+ test.done();
+ }
};