Comparing version 1.1.7 to 1.1.8
@@ -166,3 +166,3 @@ // == BDS2 LICENSE == | ||
mask = mask || DEFAULT_DISPLAY_MASK; | ||
return _applyMask(moment(timestamp).zone(-offset), mask); | ||
return _applyMask(moment(timestamp).utcOffset(offset), mask); | ||
}, | ||
@@ -178,6 +178,3 @@ /* | ||
formatForStorage: function(timestamp, offset) { | ||
console.warn('Warning! This method used to expect an offset ~to~ UTC, but now it expects and offset ~from~ UTC. Double-check your usage.'); | ||
// we use -offset here because moment deals in offsets that are ~to~ UTC | ||
// but we store JavaScript Date-style offsets that are ~from~ UTC | ||
return moment(timestamp).zone(-offset).format(); | ||
return moment(timestamp).utcOffset(offset).format(); | ||
}, | ||
@@ -236,3 +233,3 @@ /* | ||
// but we store JavaScript Date-style offsets that are ~from~ UTC | ||
return dt.zone(-offset) - dt.clone().zone(-offset).startOf('day'); | ||
return dt.utcOffset(offset) - dt.clone().utcOffset(offset).startOf('day'); | ||
}, | ||
@@ -245,3 +242,3 @@ /* | ||
getOffset: function() { | ||
return -moment().zone(); | ||
return moment().utcOffset(); | ||
}, | ||
@@ -254,3 +251,2 @@ /* | ||
getOffsetFromTime: function(timestamp) { | ||
console.warn('Warning! This method used to return the offset ~to~ UTC, but now it returns the offset ~from~ UTC. Double-check your usage.'); | ||
function containsZone() { | ||
@@ -261,5 +257,5 @@ var zonePattern = /^([+-][0-2]\d:[0-5]\d)$/; | ||
if (containsZone()) { | ||
return -moment.parseZone(timestamp).zone(); | ||
return moment.parseZone(timestamp).utcOffset(); | ||
} | ||
return -moment(timestamp).zone(); | ||
return moment(timestamp).utcOffset(); | ||
}, | ||
@@ -273,3 +269,3 @@ /* | ||
this.checkTimezoneName(timezone); | ||
return -moment.utc(timestamp).tz(timezone).zone(); | ||
return moment.utc(timestamp).tz(timezone).utcOffset(); | ||
}, | ||
@@ -276,0 +272,0 @@ /* |
{ | ||
"name": "sundial", | ||
"version": "1.1.7", | ||
"version": "1.1.8", | ||
"description": "Tidepool's datetime wrapper", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
25522
553