moment-timezone
Advanced tools
Comparing version 0.2.5 to 0.3.0
@@ -0,1 +1,8 @@ | ||
### `0.3.0` _2015-01-13_ | ||
* *Breaking:* Added country data to the `meta/*.json` files. Restructured the data to support multiple countries per zone. [#162](https://github.com/moment/moment-timezone/pull/162) | ||
* Added the ability to set a default timezone for all new moments. [#152](https://github.com/moment/moment-timezone/pull/152) | ||
* Fixed a bug when passing a moment with an offset to `moment.tz`. [#169](https://github.com/moment/moment-timezone/pull/169) | ||
* Fixed a deprecation in moment core, changing `moment#zone` to `moment#utcOffset`. [#168](https://github.com/moment/moment-timezone/pull/168) | ||
### `0.2.5` _2014-11-12_ | ||
@@ -2,0 +9,0 @@ * Updated data to IANA TZDB `2014j`. [#151](https://github.com/moment/moment-timezone/pull/151) |
//! moment-timezone-utils.js | ||
//! version : 0.2.5 | ||
//! version : 0.3.0 | ||
//! author : Tim Wood | ||
@@ -4,0 +4,0 @@ //! license : MIT |
//! moment-timezone.js | ||
//! version : 0.2.5 | ||
//! version : 0.3.0 | ||
//! author : Tim Wood | ||
@@ -24,3 +24,3 @@ //! license : MIT | ||
var VERSION = "0.2.5", | ||
var VERSION = "0.3.0", | ||
zones = {}, | ||
@@ -306,3 +306,3 @@ links = {}, | ||
function tz () { | ||
function tz (input) { | ||
var args = Array.prototype.slice.call(arguments, 0, -1), | ||
@@ -313,3 +313,3 @@ name = arguments[arguments.length - 1], | ||
if (zone && needsOffset(out)) { | ||
if (zone && !moment.isMoment(input) && needsOffset(out)) { | ||
out.add(zone.parse(out), 'minutes'); | ||
@@ -348,4 +348,9 @@ } | ||
moment.defaultZone = null; | ||
moment.updateOffset = function (mom, keepTime) { | ||
var offset; | ||
if (mom._z === undefined) { | ||
mom._z = moment.defaultZone; | ||
} | ||
if (mom._z) { | ||
@@ -356,3 +361,7 @@ offset = mom._z.offset(mom); | ||
} | ||
mom.zone(offset, keepTime); | ||
if (mom.utcOffset !== undefined) { | ||
mom.utcOffset(-offset, keepTime); | ||
} else { | ||
mom.zone(offset, keepTime); | ||
} | ||
} | ||
@@ -392,2 +401,10 @@ }; | ||
moment.tz.setDefault = function(name) { | ||
if (major < 2 || (major === 2 && minor < 9)) { | ||
logError('Moment Timezone setDefault() requires Moment.js >= 2.9.0. You are using Moment.js ' + moment.version + '.'); | ||
} | ||
moment.defaultZone = name ? getZone(name) : null; | ||
return moment; | ||
}; | ||
// Cloning a moment should include the _z property. | ||
@@ -394,0 +411,0 @@ var momentProperties = moment.momentProperties; |
{ | ||
"name": "moment-timezone", | ||
"version": "0.2.5", | ||
"version": "0.3.0", | ||
"description": "Parse and display moments in any timezone.", | ||
@@ -5,0 +5,0 @@ "homepage": "http://momentjs.com/timezone/", |
Sorry, the diff of this file is too big to display
2381565
130218