You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

5 lines
30 KiB

10 years ago
  1. //! moment-timezone.js
  2. //! version : 0.2.2
  3. //! author : Tim Wood
  4. //! license : MIT
  5. //! github.com/moment/moment-timezone
  6. !function(a,b){"use strict";"function"==typeof define&&define.amd?define(["moment"],b):"object"==typeof exports?module.exports=b(require("moment")):b(a.moment)}(this,function(a){"use strict";function b(a){return a>96?a-87:a>64?a-29:a-48}function c(a){var c,d=0,e=a.split("."),f=e[0],g=e[1]||"",h=1,i=0,j=1;for(45===a.charCodeAt(0)&&(d=1,j=-1),d;d<f.length;d++)c=b(f.charCodeAt(d)),i=60*i+c;for(d=0;d<g.length;d++)h/=60,c=b(g.charCodeAt(d)),i+=c*h;return i*j}function d(a){for(var b=0;b<a.length;b++)a[b]=c(a[b])}function e(a,b){for(var c=0;b>c;c++)a[c]=Math.round((a[c-1]||0)+6e4*a[c]);a[b-1]=1/0}function f(a,b){var c,d=[];for(c=0;c<b.length;c++)d[c]=a[b[c]];return d}function g(a){var b=a.split("|"),c=b[2].split(" "),g=b[3].split(""),h=b[4].split(" ");return d(c),d(g),d(h),e(h,g.length),{name:b[0],abbrs:f(b[1].split(" "),g),offsets:f(c,g),untils:h}}function h(a){a&&this._set(g(a))}function i(a){return(a||"").toLowerCase().replace(/\//g,"_")}function j(a){var b,c,d;for("string"==typeof a&&(a=[a]),b=0;b<a.length;b++)c=new h(a[b]),d=i(c.name),y[d]=c,n(d)}function k(a){return y[i(a)]||null}function l(){var a,b=[];for(a in y)y.hasOwnProperty(a)&&y[a]&&b.push(y[a].name);return b.sort()}function m(a){var b,c;for("string"==typeof a&&(a=[a]),b=0;b<a.length;b++)c=a[b].split("|"),p(c[0],c[1]),p(c[1],c[0])}function n(a){if(z[a]){var b,c=y[a],d=z[a];for(b=0;b<d.length;b++)o(c,d[b]);z[a]=null}}function o(a,b){var c=y[i(b)]=new h;c._set(a),c.name=b}function p(a,b){a=i(a),y[a]?o(y[a],b):(z[a]=z[a]||[],z[a].push(b))}function q(a){j(a.zones),m(a.links),u.dataVersion=a.version}function r(a){return r.didShowError||(r.didShowError=!0,t("moment.tz.zoneExists('"+a+"') has been deprecated in favor of !moment.tz.zone('"+a+"')")),!!k(a)}function s(a){return!(!a._a||void 0!==a._tzm)}function t(a){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(a)}function u(){var b=Array.prototype.slice.call(arguments,0,-1),c=arguments[arguments.length-1],d=k(c),e=a.utc.apply(null,b);return d&&s(e)&&e.add(d.parse(e),"minutes"),e.tz(c),e}function v(a){return function(){return this._z?this._z.abbr(this):a.call(this)}}function w(a){return function(){return this._z=null,a.apply(this,arguments)}}if(void 0!==a.tz)return a;var x="0.2.2",y={},z={},A=a.version.split("."),B=+A[0],C=+A[1];(2>B||2===B&&6>C)&&t("Moment Timezone requires Moment.js >= 2.6.0. You are using Moment.js "+a.version+". See momentjs.com"),h.prototype={_set:function(a){this.name=a.name,this.abbrs=a.abbrs,this.untils=a.untils,this.offsets=a.offsets},_index:function(a){var b,c=+a,d=this.untils;for(b=0;b<d.length;b++)if(c<d[b])return b},parse:function(a){var b,c,d,e,f=+a,g=this.offsets,h=this.untils,i=h.length-1;for(e=0;i>e;e++)if(b=g[e],c=g[e+1],d=g[e?e-1:e],c>b&&u.moveAmbiguousForward?b=c:b>d&&u.moveInvalidForward&&(b=d),f<h[e]-6e4*b)return g[e];return g[i]},abbr:function(a){return this.abbrs[this._index(a)]},offset:function(a){return this.offsets[this._index(a)]}},u.version=x,u.dataVersion="",u._zones=y,u._links=z,u.add=j,u.link=m,u.load=q,u.zone=k,u.zoneExists=r,u.names=l,u.Zone=h,u.unpack=g,u.unpackBase60=c,u.needsOffset=s,u.moveInvalidForward=!0,u.moveAmbiguousForward=!1;var D=a.fn;a.tz=u,a.updateOffset=function(a,b){var c;a._z&&(c=a._z.offset(a),Math.abs(c)<16&&(c/=60),a.zone(c,b))},D.tz=function(b){return b?(this._z=k(b),this._z?a.updateOffset(this):t("Moment Timezone has no data for "+b+". See http://momentjs.com/timezone/docs/#/data-loading/."),this):this._z?this._z.name:void 0},D.zoneName=v(D.zoneName),D.zoneAbbr=v(D.zoneAbbr),D.utc=w(D.utc);var E=a.momentProperties;return"[object Array]"===Object.prototype.toString.call(E)?(E.push("_z"),E.push("_a")):E&&(E._z=null),q({version:"2014g",zones:["Africa/Abidjan|GMT|0|0|","Africa/Addis_Ababa|EAT|-30|0|","Africa/Algiers|CET|-10|0|","Africa/Bangui|WAT|-10|0|","Africa/Blantyre|CAT|-20|0|","Africa/Cairo|EET EEST|-20 -30|0101010101010101010101010101010|1Cby0 Fb0 c10 8n0 8Nd0 gL0 e10 mn0 1o10 jz0 gN0 pb0 1qN0 dX0 e10 xz0 1o10 bb0 e10 An0 1o10 5z0 e10 FX0 1o10 2L0 e10 IL0 1C10 Lz0","Africa/Casablanca|WET WEST|0 -10|0101010101010101010