You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by on...@apache.org on 2015/10/02 11:31:40 UTC

[1/3] ambari git commit: AMBARI-13293. Ambari Web: Set/change the timezone (onechiporenko)

Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 57a56c5e4 -> deb5a06a4


http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/vendor/scripts/moment.js
----------------------------------------------------------------------
diff --git a/ambari-web/vendor/scripts/moment.js b/ambari-web/vendor/scripts/moment.js
index b40374b..fe0e19c 100644
--- a/ambari-web/vendor/scripts/moment.js
+++ b/ambari-web/vendor/scripts/moment.js
@@ -1,466 +1,213 @@
 //! moment.js
-//! version : 2.5.1
+//! version : 2.10.6
 //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
 //! license : MIT
 //! momentjs.com
 
-(function (undefined) {
-
-  /************************************
-   Constants
-   ************************************/
-
-  var moment,
-    VERSION = "2.5.1",
-    global = this,
-    round = Math.round,
-    i,
-
-    YEAR = 0,
-    MONTH = 1,
-    DATE = 2,
-    HOUR = 3,
-    MINUTE = 4,
-    SECOND = 5,
-    MILLISECOND = 6,
-
-  // internal storage for language config files
-    languages = {},
-
-  // moment internal properties
-    momentProperties = {
-      _isAMomentObject: null,
-      _i : null,
-      _f : null,
-      _l : null,
-      _strict : null,
-      _isUTC : null,
-      _offset : null,  // optional. Combine with _isUTC
-      _pf : null,
-      _lang : null  // optional
-    },
-
-  // check for nodeJS
-    hasModule = (typeof module !== 'undefined' && module.exports && typeof require !== 'undefined'),
-
-  // ASP.NET json date format regex
-    aspNetJsonRegex = /^\/?Date\((\-?\d+)/i,
-    aspNetTimeSpanJsonRegex = /(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,
+(function (global, factory) {
+  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
+    typeof define === 'function' && define.amd ? define(factory) :
+      global.moment = factory()
+}(this, function () { 'use strict';
 
-  // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
-  // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
-    isoDurationRegex = /^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,
-
-  // format tokens
-    formattingTokens = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|X|zz?|ZZ?|.)/g,
-    localFormattingTokens = /(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,
-
-  // parsing token regexes
-    parseTokenOneOrTwoDigits = /\d\d?/, // 0 - 99
-    parseTokenOneToThreeDigits = /\d{1,3}/, // 0 - 999
-    parseTokenOneToFourDigits = /\d{1,4}/, // 0 - 9999
-    parseTokenOneToSixDigits = /[+\-]?\d{1,6}/, // -999,999 - 999,999
-    parseTokenDigits = /\d+/, // nonzero number of digits
-    parseTokenWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i, // any word (or two) characters or numbers including two/three word month in arabic.
-    parseTokenTimezone = /Z|[\+\-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z
-    parseTokenT = /T/i, // T (ISO separator)
-    parseTokenTimestampMs = /[\+\-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123
-
-  //strict parsing regexes
-    parseTokenOneDigit = /\d/, // 0 - 9
-    parseTokenTwoDigits = /\d\d/, // 00 - 99
-    parseTokenThreeDigits = /\d{3}/, // 000 - 999
-    parseTokenFourDigits = /\d{4}/, // 0000 - 9999
-    parseTokenSixDigits = /[+-]?\d{6}/, // -999,999 - 999,999
-    parseTokenSignedNumber = /[+-]?\d+/, // -inf - inf
-
-  // iso 8601 regex
-  // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)
-    isoRegex = /^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,
-
-    isoFormat = 'YYYY-MM-DDTHH:mm:ssZ',
-
-    isoDates = [
-      ['YYYYYY-MM-DD', /[+-]\d{6}-\d{2}-\d{2}/],
-      ['YYYY-MM-DD', /\d{4}-\d{2}-\d{2}/],
-      ['GGGG-[W]WW-E', /\d{4}-W\d{2}-\d/],
-      ['GGGG-[W]WW', /\d{4}-W\d{2}/],
-      ['YYYY-DDD', /\d{4}-\d{3}/]
-    ],
-
-  // iso time formats and regexes
-    isoTimes = [
-      ['HH:mm:ss.SSSS', /(T| )\d\d:\d\d:\d\d\.\d{1,3}/],
-      ['HH:mm:ss', /(T| )\d\d:\d\d:\d\d/],
-      ['HH:mm', /(T| )\d\d:\d\d/],
-      ['HH', /(T| )\d\d/]
-    ],
-
-  // timezone chunker "+10:00" > ["10", "00"] or "-1530" > ["-15", "30"]
-    parseTimezoneChunker = /([\+\-]|\d\d)/gi,
-
-  // getter and setter names
-    proxyGettersAndSetters = 'Date|Hours|Minutes|Seconds|Milliseconds'.split('|'),
-    unitMillisecondFactors = {
-      'Milliseconds' : 1,
-      'Seconds' : 1e3,
-      'Minutes' : 6e4,
-      'Hours' : 36e5,
-      'Days' : 864e5,
-      'Months' : 2592e6,
-      'Years' : 31536e6
-    },
-
-    unitAliases = {
-      ms : 'millisecond',
-      s : 'second',
-      m : 'minute',
-      h : 'hour',
-      d : 'day',
-      D : 'date',
-      w : 'week',
-      W : 'isoWeek',
-      M : 'month',
-      y : 'year',
-      DDD : 'dayOfYear',
-      e : 'weekday',
-      E : 'isoWeekday',
-      gg: 'weekYear',
-      GG: 'isoWeekYear'
-    },
-
-    camelFunctions = {
-      dayofyear : 'dayOfYear',
-      isoweekday : 'isoWeekday',
-      isoweek : 'isoWeek',
-      weekyear : 'weekYear',
-      isoweekyear : 'isoWeekYear'
-    },
-
-  // format function strings
-    formatFunctions = {},
-
-  // tokens to ordinalize and pad
-    ordinalizeTokens = 'DDD w W M D d'.split(' '),
-    paddedTokens = 'M D H h m s w W'.split(' '),
-
-    formatTokenFunctions = {
-      M    : function () {
-        return this.month() + 1;
-      },
-      MMM  : function (format) {
-        return this.lang().monthsShort(this, format);
-      },
-      MMMM : function (format) {
-        return this.lang().months(this, format);
-      },
-      D    : function () {
-        return this.date();
-      },
-      DDD  : function () {
-        return this.dayOfYear();
-      },
-      d    : function () {
-        return this.day();
-      },
-      dd   : function (format) {
-        return this.lang().weekdaysMin(this, format);
-      },
-      ddd  : function (format) {
-        return this.lang().weekdaysShort(this, format);
-      },
-      dddd : function (format) {
-        return this.lang().weekdays(this, format);
-      },
-      w    : function () {
-        return this.week();
-      },
-      W    : function () {
-        return this.isoWeek();
-      },
-      YY   : function () {
-        return leftZeroFill(this.year() % 100, 2);
-      },
-      YYYY : function () {
-        return leftZeroFill(this.year(), 4);
-      },
-      YYYYY : function () {
-        return leftZeroFill(this.year(), 5);
-      },
-      YYYYYY : function () {
-        var y = this.year(), sign = y >= 0 ? '+' : '-';
-        return sign + leftZeroFill(Math.abs(y), 6);
-      },
-      gg   : function () {
-        return leftZeroFill(this.weekYear() % 100, 2);
-      },
-      gggg : function () {
-        return leftZeroFill(this.weekYear(), 4);
-      },
-      ggggg : function () {
-        return leftZeroFill(this.weekYear(), 5);
-      },
-      GG   : function () {
-        return leftZeroFill(this.isoWeekYear() % 100, 2);
-      },
-      GGGG : function () {
-        return leftZeroFill(this.isoWeekYear(), 4);
-      },
-      GGGGG : function () {
-        return leftZeroFill(this.isoWeekYear(), 5);
-      },
-      e : function () {
-        return this.weekday();
-      },
-      E : function () {
-        return this.isoWeekday();
-      },
-      a    : function () {
-        return this.lang().meridiem(this.hours(), this.minutes(), true);
-      },
-      A    : function () {
-        return this.lang().meridiem(this.hours(), this.minutes(), false);
-      },
-      H    : function () {
-        return this.hours();
-      },
-      h    : function () {
-        return this.hours() % 12 || 12;
-      },
-      m    : function () {
-        return this.minutes();
-      },
-      s    : function () {
-        return this.seconds();
-      },
-      S    : function () {
-        return toInt(this.milliseconds() / 100);
-      },
-      SS   : function () {
-        return leftZeroFill(toInt(this.milliseconds() / 10), 2);
-      },
-      SSS  : function () {
-        return leftZeroFill(this.milliseconds(), 3);
-      },
-      SSSS : function () {
-        return leftZeroFill(this.milliseconds(), 3);
-      },
-      Z    : function () {
-        var a = -this.zone(),
-          b = "+";
-        if (a < 0) {
-          a = -a;
-          b = "-";
-        }
-        return b + leftZeroFill(toInt(a / 60), 2) + ":" + leftZeroFill(toInt(a) % 60, 2);
-      },
-      ZZ   : function () {
-        var a = -this.zone(),
-          b = "+";
-        if (a < 0) {
-          a = -a;
-          b = "-";
-        }
-        return b + leftZeroFill(toInt(a / 60), 2) + leftZeroFill(toInt(a) % 60, 2);
-      },
-      z : function () {
-        return this.zoneAbbr();
-      },
-      zz : function () {
-        return this.zoneName();
-      },
-      X    : function () {
-        return this.unix();
-      },
-      Q : function () {
-        return this.quarter();
-      }
-    },
-
-    lists = ['months', 'monthsShort', 'weekdays', 'weekdaysShort', 'weekdaysMin'];
+  var hookCallback;
 
-  function defaultParsingFlags() {
-    // We need to deep clone this object, and es5 standard is not very
-    // helpful.
-    return {
-      empty : false,
-      unusedTokens : [],
-      unusedInput : [],
-      overflow : -2,
-      charsLeftOver : 0,
-      nullInput : false,
-      invalidMonth : null,
-      invalidFormat : false,
-      userInvalidated : false,
-      iso: false
-    };
+  function utils_hooks__hooks () {
+    return hookCallback.apply(null, arguments);
   }
 
-  function padToken(func, count) {
-    return function (a) {
-      return leftZeroFill(func.call(this, a), count);
-    };
-  }
-  function ordinalizeToken(func, period) {
-    return function (a) {
-      return this.lang().ordinal(func.call(this, a), period);
-    };
+  // This is done to register the method called with moment()
+  // without creating circular dependencies.
+  function setHookCallback (callback) {
+    hookCallback = callback;
   }
 
-  while (ordinalizeTokens.length) {
-    i = ordinalizeTokens.pop();
-    formatTokenFunctions[i + 'o'] = ordinalizeToken(formatTokenFunctions[i], i);
-  }
-  while (paddedTokens.length) {
-    i = paddedTokens.pop();
-    formatTokenFunctions[i + i] = padToken(formatTokenFunctions[i], 2);
+  function isArray(input) {
+    return Object.prototype.toString.call(input) === '[object Array]';
   }
-  formatTokenFunctions.DDDD = padToken(formatTokenFunctions.DDD, 3);
-
-
-  /************************************
-   Constructors
-   ************************************/
-
-  function Language() {
 
+  function isDate(input) {
+    return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]';
   }
 
-  // Moment prototype object
-  function Moment(config) {
-    checkOverflow(config);
-    extend(this, config);
+  function map(arr, fn) {
+    var res = [], i;
+    for (i = 0; i < arr.length; ++i) {
+      res.push(fn(arr[i], i));
+    }
+    return res;
   }
 
-  // Duration Constructor
-  function Duration(duration) {
-    var normalizedInput = normalizeObjectUnits(duration),
-      years = normalizedInput.year || 0,
-      months = normalizedInput.month || 0,
-      weeks = normalizedInput.week || 0,
-      days = normalizedInput.day || 0,
-      hours = normalizedInput.hour || 0,
-      minutes = normalizedInput.minute || 0,
-      seconds = normalizedInput.second || 0,
-      milliseconds = normalizedInput.millisecond || 0;
-
-    // representation for dateAddRemove
-    this._milliseconds = +milliseconds +
-      seconds * 1e3 + // 1000
-      minutes * 6e4 + // 1000 * 60
-      hours * 36e5; // 1000 * 60 * 60
-    // Because of dateAddRemove treats 24 hours as different from a
-    // day when working around DST, we need to store them separately
-    this._days = +days +
-      weeks * 7;
-    // It is impossible translate months into days without knowing
-    // which months you are are talking about, so we have to store
-    // it separately.
-    this._months = +months +
-      years * 12;
-
-    this._data = {};
-
-    this._bubble();
+  function hasOwnProp(a, b) {
+    return Object.prototype.hasOwnProperty.call(a, b);
   }
 
-  /************************************
-   Helpers
-   ************************************/
-
-
   function extend(a, b) {
     for (var i in b) {
-      if (b.hasOwnProperty(i)) {
+      if (hasOwnProp(b, i)) {
         a[i] = b[i];
       }
     }
 
-    if (b.hasOwnProperty("toString")) {
+    if (hasOwnProp(b, 'toString')) {
       a.toString = b.toString;
     }
 
-    if (b.hasOwnProperty("valueOf")) {
+    if (hasOwnProp(b, 'valueOf')) {
       a.valueOf = b.valueOf;
     }
 
     return a;
   }
 
-  function cloneMoment(m) {
-    var result = {}, i;
-    for (i in m) {
-      if (m.hasOwnProperty(i) && momentProperties.hasOwnProperty(i)) {
-        result[i] = m[i];
-      }
-    }
+  function create_utc__createUTC (input, format, locale, strict) {
+    return createLocalOrUTC(input, format, locale, strict, true).utc();
+  }
 
-    return result;
+  function defaultParsingFlags() {
+    // We need to deep clone this object.
+    return {
+      empty           : false,
+      unusedTokens    : [],
+      unusedInput     : [],
+      overflow        : -2,
+      charsLeftOver   : 0,
+      nullInput       : false,
+      invalidMonth    : null,
+      invalidFormat   : false,
+      userInvalidated : false,
+      iso             : false
+    };
   }
 
-  function absRound(number) {
-    if (number < 0) {
-      return Math.ceil(number);
-    } else {
-      return Math.floor(number);
+  function getParsingFlags(m) {
+    if (m._pf == null) {
+      m._pf = defaultParsingFlags();
     }
+    return m._pf;
   }
 
-  // left zero fill a number
-  // see http://jsperf.com/left-zero-filling for performance comparison
-  function leftZeroFill(number, targetLength, forceSign) {
-    var output = '' + Math.abs(number),
-      sign = number >= 0;
+  function valid__isValid(m) {
+    if (m._isValid == null) {
+      var flags = getParsingFlags(m);
+      m._isValid = !isNaN(m._d.getTime()) &&
+        flags.overflow < 0 &&
+        !flags.empty &&
+        !flags.invalidMonth &&
+        !flags.invalidWeekday &&
+        !flags.nullInput &&
+        !flags.invalidFormat &&
+        !flags.userInvalidated;
 
-    while (output.length < targetLength) {
-      output = '0' + output;
+      if (m._strict) {
+        m._isValid = m._isValid &&
+          flags.charsLeftOver === 0 &&
+          flags.unusedTokens.length === 0 &&
+          flags.bigHour === undefined;
+      }
     }
-    return (sign ? (forceSign ? '+' : '') : '-') + output;
+    return m._isValid;
   }
 
-  // helper function for _.addTime and _.subtractTime
-  function addOrSubtractDurationFromMoment(mom, duration, isAdding, ignoreUpdateOffset) {
-    var milliseconds = duration._milliseconds,
-      days = duration._days,
-      months = duration._months,
-      minutes,
-      hours;
+  function valid__createInvalid (flags) {
+    var m = create_utc__createUTC(NaN);
+    if (flags != null) {
+      extend(getParsingFlags(m), flags);
+    }
+    else {
+      getParsingFlags(m).userInvalidated = true;
+    }
 
-    if (milliseconds) {
-      mom._d.setTime(+mom._d + milliseconds * isAdding);
+    return m;
+  }
+
+  var momentProperties = utils_hooks__hooks.momentProperties = [];
+
+  function copyConfig(to, from) {
+    var i, prop, val;
+
+    if (typeof from._isAMomentObject !== 'undefined') {
+      to._isAMomentObject = from._isAMomentObject;
     }
-    // store the minutes and hours so we can restore them
-    if (days || months) {
-      minutes = mom.minute();
-      hours = mom.hour();
+    if (typeof from._i !== 'undefined') {
+      to._i = from._i;
     }
-    if (days) {
-      mom.date(mom.date() + days * isAdding);
+    if (typeof from._f !== 'undefined') {
+      to._f = from._f;
     }
-    if (months) {
-      mom.month(mom.month() + months * isAdding);
+    if (typeof from._l !== 'undefined') {
+      to._l = from._l;
+    }
+    if (typeof from._strict !== 'undefined') {
+      to._strict = from._strict;
+    }
+    if (typeof from._tzm !== 'undefined') {
+      to._tzm = from._tzm;
+    }
+    if (typeof from._isUTC !== 'undefined') {
+      to._isUTC = from._isUTC;
     }
-    if (milliseconds && !ignoreUpdateOffset) {
-      moment.updateOffset(mom);
+    if (typeof from._offset !== 'undefined') {
+      to._offset = from._offset;
+    }
+    if (typeof from._pf !== 'undefined') {
+      to._pf = getParsingFlags(from);
+    }
+    if (typeof from._locale !== 'undefined') {
+      to._locale = from._locale;
+    }
+
+    if (momentProperties.length > 0) {
+      for (i in momentProperties) {
+        prop = momentProperties[i];
+        val = from[prop];
+        if (typeof val !== 'undefined') {
+          to[prop] = val;
+        }
+      }
     }
-    // restore the minutes and hours after possibly changing dst
-    if (days || months) {
-      mom.minute(minutes);
-      mom.hour(hours);
+
+    return to;
+  }
+
+  var updateInProgress = false;
+
+  // Moment prototype object
+  function Moment(config) {
+    copyConfig(this, config);
+    this._d = new Date(config._d != null ? config._d.getTime() : NaN);
+    // Prevent infinite loop in case updateOffset creates new moment
+    // objects.
+    if (updateInProgress === false) {
+      updateInProgress = true;
+      utils_hooks__hooks.updateOffset(this);
+      updateInProgress = false;
     }
   }
 
-  // check if is an array
-  function isArray(input) {
-    return Object.prototype.toString.call(input) === '[object Array]';
+  function isMoment (obj) {
+    return obj instanceof Moment || (obj != null && obj._isAMomentObject != null);
   }
 
-  function isDate(input) {
-    return  Object.prototype.toString.call(input) === '[object Date]' ||
-      input instanceof Date;
+  function absFloor (number) {
+    if (number < 0) {
+      return Math.ceil(number);
+    } else {
+      return Math.floor(number);
+    }
+  }
+
+  function toInt(argumentForCoercion) {
+    var coercedNumber = +argumentForCoercion,
+      value = 0;
+
+    if (coercedNumber !== 0 && isFinite(coercedNumber)) {
+      value = absFloor(coercedNumber);
+    }
+
+    return value;
   }
 
-  // compare two arrays, return the number of differences
   function compareArrays(array1, array2, dontConvert) {
     var len = Math.min(array1.length, array2.length),
       lengthDiff = Math.abs(array1.length - array2.length),
@@ -475,417 +222,234 @@
     return diffs + lengthDiff;
   }
 
-  function normalizeUnits(units) {
-    if (units) {
-      var lowered = units.toLowerCase().replace(/(.)s$/, '$1');
-      units = unitAliases[units] || camelFunctions[lowered] || lowered;
-    }
-    return units;
+  function Locale() {
   }
 
-  function normalizeObjectUnits(inputObject) {
-    var normalizedInput = {},
-      normalizedProp,
-      prop;
-
-    for (prop in inputObject) {
-      if (inputObject.hasOwnProperty(prop)) {
-        normalizedProp = normalizeUnits(prop);
-        if (normalizedProp) {
-          normalizedInput[normalizedProp] = inputObject[prop];
-        }
-      }
-    }
+  var locales = {};
+  var globalLocale;
 
-    return normalizedInput;
+  function normalizeLocale(key) {
+    return key ? key.toLowerCase().replace('_', '-') : key;
   }
 
-  function makeList(field) {
-    var count, setter;
-
-    if (field.indexOf('week') === 0) {
-      count = 7;
-      setter = 'day';
-    }
-    else if (field.indexOf('month') === 0) {
-      count = 12;
-      setter = 'month';
-    }
-    else {
-      return;
-    }
-
-    moment[field] = function (format, index) {
-      var i, getter,
-        method = moment.fn._lang[field],
-        results = [];
+  // pick the locale from the array
+  // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
+  // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
+  function chooseLocale(names) {
+    var i = 0, j, next, locale, split;
 
-      if (typeof format === 'number') {
-        index = format;
-        format = undefined;
+    while (i < names.length) {
+      split = normalizeLocale(names[i]).split('-');
+      j = split.length;
+      next = normalizeLocale(names[i + 1]);
+      next = next ? next.split('-') : null;
+      while (j > 0) {
+        locale = loadLocale(split.slice(0, j).join('-'));
+        if (locale) {
+          return locale;
+        }
+        if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
+          //the next array item is better than a shallower substring of this one
+          break;
+        }
+        j--;
       }
+      i++;
+    }
+    return null;
+  }
 
-      getter = function (i) {
-        var m = moment().utc().set(setter, i);
-        return method.call(moment.fn._lang, m, format || '');
-      };
+  function loadLocale(name) {
+    var oldLocale = null;
+    // TODO: Find a better way to register and load all the locales in Node
+    if (!locales[name] && typeof module !== 'undefined' &&
+      module && module.exports) {
+      try {
+        oldLocale = globalLocale._abbr;
+        require('./locale/' + name);
+        // because defineLocale currently also sets the global locale, we
+        // want to undo that for lazy loaded locales
+        locale_locales__getSetGlobalLocale(oldLocale);
+      } catch (e) { }
+    }
+    return locales[name];
+  }
 
-      if (index != null) {
-        return getter(index);
+  // This function will load locale and then set the global locale.  If
+  // no arguments are passed in, it will simply return the current global
+  // locale key.
+  function locale_locales__getSetGlobalLocale (key, values) {
+    var data;
+    if (key) {
+      if (typeof values === 'undefined') {
+        data = locale_locales__getLocale(key);
       }
       else {
-        for (i = 0; i < count; i++) {
-          results.push(getter(i));
-        }
-        return results;
+        data = defineLocale(key, values);
       }
-    };
-  }
-
-  function toInt(argumentForCoercion) {
-    var coercedNumber = +argumentForCoercion,
-      value = 0;
 
-    if (coercedNumber !== 0 && isFinite(coercedNumber)) {
-      if (coercedNumber >= 0) {
-        value = Math.floor(coercedNumber);
-      } else {
-        value = Math.ceil(coercedNumber);
+      if (data) {
+        // moment.duration._locale = moment._locale = data;
+        globalLocale = data;
       }
     }
 
-    return value;
+    return globalLocale._abbr;
   }
 
-  function daysInMonth(year, month) {
-    return new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
-  }
+  function defineLocale (name, values) {
+    if (values !== null) {
+      values.abbr = name;
+      locales[name] = locales[name] || new Locale();
+      locales[name].set(values);
 
-  function daysInYear(year) {
-    return isLeapYear(year) ? 366 : 365;
-  }
+      // backwards compat for now: also set the locale
+      locale_locales__getSetGlobalLocale(name);
 
-  function isLeapYear(year) {
-    return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
+      return locales[name];
+    } else {
+      // useful for testing
+      delete locales[name];
+      return null;
+    }
   }
 
-  function checkOverflow(m) {
-    var overflow;
-    if (m._a && m._pf.overflow === -2) {
-      overflow =
-        m._a[MONTH] < 0 || m._a[MONTH] > 11 ? MONTH :
-          m._a[DATE] < 1 || m._a[DATE] > daysInMonth(m._a[YEAR], m._a[MONTH]) ? DATE :
-            m._a[HOUR] < 0 || m._a[HOUR] > 23 ? HOUR :
-              m._a[MINUTE] < 0 || m._a[MINUTE] > 59 ? MINUTE :
-                m._a[SECOND] < 0 || m._a[SECOND] > 59 ? SECOND :
-                  m._a[MILLISECOND] < 0 || m._a[MILLISECOND] > 999 ? MILLISECOND :
-                    -1;
-
-      if (m._pf._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
-        overflow = DATE;
-      }
+  // returns locale data
+  function locale_locales__getLocale (key) {
+    var locale;
 
-      m._pf.overflow = overflow;
+    if (key && key._locale && key._locale._abbr) {
+      key = key._locale._abbr;
     }
-  }
 
-  function isValid(m) {
-    if (m._isValid == null) {
-      m._isValid = !isNaN(m._d.getTime()) &&
-        m._pf.overflow < 0 &&
-        !m._pf.empty &&
-        !m._pf.invalidMonth &&
-        !m._pf.nullInput &&
-        !m._pf.invalidFormat &&
-        !m._pf.userInvalidated;
+    if (!key) {
+      return globalLocale;
+    }
 
-      if (m._strict) {
-        m._isValid = m._isValid &&
-          m._pf.charsLeftOver === 0 &&
-          m._pf.unusedTokens.length === 0;
+    if (!isArray(key)) {
+      //short-circuit everything else
+      locale = loadLocale(key);
+      if (locale) {
+        return locale;
       }
+      key = [key];
     }
-    return m._isValid;
-  }
 
-  function normalizeLanguage(key) {
-    return key ? key.toLowerCase().replace('_', '-') : key;
+    return chooseLocale(key);
   }
 
-  // Return a moment from input, that is local/utc/zone equivalent to model.
-  function makeAs(input, model) {
-    return model._isUTC ? moment(input).zone(model._offset || 0) :
-      moment(input).local();
-  }
+  var aliases = {};
 
-  /************************************
-   Languages
-   ************************************/
+  function addUnitAlias (unit, shorthand) {
+    var lowerCase = unit.toLowerCase();
+    aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
+  }
 
+  function normalizeUnits(units) {
+    return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined;
+  }
 
-  extend(Language.prototype, {
+  function normalizeObjectUnits(inputObject) {
+    var normalizedInput = {},
+      normalizedProp,
+      prop;
 
-    set : function (config) {
-      var prop, i;
-      for (i in config) {
-        prop = config[i];
-        if (typeof prop === 'function') {
-          this[i] = prop;
-        } else {
-          this['_' + i] = prop;
+    for (prop in inputObject) {
+      if (hasOwnProp(inputObject, prop)) {
+        normalizedProp = normalizeUnits(prop);
+        if (normalizedProp) {
+          normalizedInput[normalizedProp] = inputObject[prop];
         }
       }
-    },
-
-    _months : "January_February_March_April_May_June_July_August_September_October_November_December".split("_"),
-    months : function (m) {
-      return this._months[m.month()];
-    },
-
-    _monthsShort : "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),
-    monthsShort : function (m) {
-      return this._monthsShort[m.month()];
-    },
-
-    monthsParse : function (monthName) {
-      var i, mom, regex;
+    }
 
-      if (!this._monthsParse) {
-        this._monthsParse = [];
-      }
+    return normalizedInput;
+  }
 
-      for (i = 0; i < 12; i++) {
-        // make the regex if we don't have it already
-        if (!this._monthsParse[i]) {
-          mom = moment.utc([2000, i]);
-          regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
-          this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
-        }
-        // test the regex
-        if (this._monthsParse[i].test(monthName)) {
-          return i;
-        }
+  function makeGetSet (unit, keepTime) {
+    return function (value) {
+      if (value != null) {
+        get_set__set(this, unit, value);
+        utils_hooks__hooks.updateOffset(this, keepTime);
+        return this;
+      } else {
+        return get_set__get(this, unit);
       }
-    },
-
-    _weekdays : "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
-    weekdays : function (m) {
-      return this._weekdays[m.day()];
-    },
-
-    _weekdaysShort : "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),
-    weekdaysShort : function (m) {
-      return this._weekdaysShort[m.day()];
-    },
+    };
+  }
 
-    _weekdaysMin : "Su_Mo_Tu_We_Th_Fr_Sa".split("_"),
-    weekdaysMin : function (m) {
-      return this._weekdaysMin[m.day()];
-    },
+  function get_set__get (mom, unit) {
+    return mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]();
+  }
 
-    weekdaysParse : function (weekdayName) {
-      var i, mom, regex;
+  function get_set__set (mom, unit, value) {
+    return mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
+  }
 
-      if (!this._weekdaysParse) {
-        this._weekdaysParse = [];
-      }
+  // MOMENTS
 
-      for (i = 0; i < 7; i++) {
-        // make the regex if we don't have it already
-        if (!this._weekdaysParse[i]) {
-          mom = moment([2000, 1]).day(i);
-          regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
-          this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
-        }
-        // test the regex
-        if (this._weekdaysParse[i].test(weekdayName)) {
-          return i;
-        }
+  function getSet (units, value) {
+    var unit;
+    if (typeof units === 'object') {
+      for (unit in units) {
+        this.set(unit, units[unit]);
       }
-    },
-
-    _longDateFormat : {
-      LT : "h:mm A",
-      L : "MM/DD/YYYY",
-      LL : "MMMM D YYYY",
-      LLL : "MMMM D YYYY LT",
-      LLLL : "dddd, MMMM D YYYY LT"
-    },
-    longDateFormat : function (key) {
-      var output = this._longDateFormat[key];
-      if (!output && this._longDateFormat[key.toUpperCase()]) {
-        output = this._longDateFormat[key.toUpperCase()].replace(/MMMM|MM|DD|dddd/g, function (val) {
-          return val.slice(1);
-        });
-        this._longDateFormat[key] = output;
-      }
-      return output;
-    },
-
-    isPM : function (input) {
-      // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
-      // Using charAt should be more compatible.
-      return ((input + '').toLowerCase().charAt(0) === 'p');
-    },
-
-    _meridiemParse : /[ap]\.?m?\.?/i,
-    meridiem : function (hours, minutes, isLower) {
-      if (hours > 11) {
-        return isLower ? 'pm' : 'PM';
-      } else {
-        return isLower ? 'am' : 'AM';
+    } else {
+      units = normalizeUnits(units);
+      if (typeof this[units] === 'function') {
+        return this[units](value);
       }
-    },
-
-    _calendar : {
-      sameDay : '[Today at] LT',
-      nextDay : '[Tomorrow at] LT',
-      nextWeek : 'dddd [at] LT',
-      lastDay : '[Yesterday at] LT',
-      lastWeek : '[Last] dddd [at] LT',
-      sameElse : 'L'
-    },
-    calendar : function (key, mom) {
-      var output = this._calendar[key];
-      return typeof output === 'function' ? output.apply(mom) : output;
-    },
-
-    _relativeTime : {
-      future : "in %s",
-      past : "%s ago",
-      s : "a few seconds",
-      m : "a minute",
-      mm : "%d minutes",
-      h : "an hour",
-      hh : "%d hours",
-      d : "a day",
-      dd : "%d days",
-      M : "a month",
-      MM : "%d months",
-      y : "a year",
-      yy : "%d years"
-    },
-    relativeTime : function (number, withoutSuffix, string, isFuture) {
-      var output = this._relativeTime[string];
-      return (typeof output === 'function') ?
-        output(number, withoutSuffix, string, isFuture) :
-        output.replace(/%d/i, number);
-    },
-    pastFuture : function (diff, output) {
-      var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
-      return typeof format === 'function' ? format(output) : format.replace(/%s/i, output);
-    },
+    }
+    return this;
+  }
 
-    ordinal : function (number) {
-      return this._ordinal.replace("%d", number);
-    },
-    _ordinal : "%d",
+  function zeroFill(number, targetLength, forceSign) {
+    var absNumber = '' + Math.abs(number),
+      zerosToFill = targetLength - absNumber.length,
+      sign = number >= 0;
+    return (sign ? (forceSign ? '+' : '') : '-') +
+      Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
+  }
 
-    preparse : function (string) {
-      return string;
-    },
+  var formattingTokens = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;
 
-    postformat : function (string) {
-      return string;
-    },
+  var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
 
-    week : function (mom) {
-      return weekOfYear(mom, this._week.dow, this._week.doy).week;
-    },
+  var formatFunctions = {};
 
-    _week : {
-      dow : 0, // Sunday is the first day of the week.
-      doy : 6  // The week that contains Jan 1st is the first week of the year.
-    },
+  var formatTokenFunctions = {};
 
-    _invalidDate: 'Invalid date',
-    invalidDate: function () {
-      return this._invalidDate;
+  // token:    'M'
+  // padded:   ['MM', 2]
+  // ordinal:  'Mo'
+  // callback: function () { this.month() + 1 }
+  function addFormatToken (token, padded, ordinal, callback) {
+    var func = callback;
+    if (typeof callback === 'string') {
+      func = function () {
+        return this[callback]();
+      };
     }
-  });
-
-  // Loads a language definition into the `languages` cache.  The function
-  // takes a key and optionally values.  If not in the browser and no values
-  // are provided, it will load the language file module.  As a convenience,
-  // this function also returns the language values.
-  function loadLang(key, values) {
-    values.abbr = key;
-    if (!languages[key]) {
-      languages[key] = new Language();
+    if (token) {
+      formatTokenFunctions[token] = func;
+    }
+    if (padded) {
+      formatTokenFunctions[padded[0]] = function () {
+        return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
+      };
+    }
+    if (ordinal) {
+      formatTokenFunctions[ordinal] = function () {
+        return this.localeData().ordinal(func.apply(this, arguments), token);
+      };
     }
-    languages[key].set(values);
-    return languages[key];
   }
 
-  // Remove a language from the `languages` cache. Mostly useful in tests.
-  function unloadLang(key) {
-    delete languages[key];
-  }
-
-  // Determines which language definition to use and returns it.
-  //
-  // With no parameters, it will return the global language.  If you
-  // pass in a language key, such as 'en', it will return the
-  // definition for 'en', so long as 'en' has already been loaded using
-  // moment.lang.
-  function getLangDefinition(key) {
-    var i = 0, j, lang, next, split,
-      get = function (k) {
-        if (!languages[k] && hasModule) {
-          try {
-            require('./lang/' + k);
-          } catch (e) { }
-        }
-        return languages[k];
-      };
-
-    if (!key) {
-      return moment.fn._lang;
-    }
-
-    if (!isArray(key)) {
-      //short-circuit everything else
-      lang = get(key);
-      if (lang) {
-        return lang;
-      }
-      key = [key];
-    }
-
-    //pick the language from the array
-    //try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
-    //substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
-    while (i < key.length) {
-      split = normalizeLanguage(key[i]).split('-');
-      j = split.length;
-      next = normalizeLanguage(key[i + 1]);
-      next = next ? next.split('-') : null;
-      while (j > 0) {
-        lang = get(split.slice(0, j).join('-'));
-        if (lang) {
-          return lang;
-        }
-        if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
-          //the next array item is better than a shallower substring of this one
-          break;
-        }
-        j--;
-      }
-      i++;
-    }
-    return moment.fn._lang;
-  }
-
-  /************************************
-   Formatting
-   ************************************/
-
-
-  function removeFormattingTokens(input) {
-    if (input.match(/\[[\s\S]/)) {
-      return input.replace(/^\[|\]$/g, "");
-    }
-    return input.replace(/\\/g, "");
+  function removeFormattingTokens(input) {
+    if (input.match(/\[[\s\S]/)) {
+      return input.replace(/^\[|\]$/g, '');
+    }
+    return input.replace(/\\/g, '');
   }
 
   function makeFormatFunction(format) {
@@ -900,7 +464,7 @@
     }
 
     return function (mom) {
-      var output = "";
+      var output = '';
       for (i = 0; i < length; i++) {
         output += array[i] instanceof Function ? array[i].call(mom, format) : array[i];
       }
@@ -910,25 +474,21 @@
 
   // format date using native date object
   function formatMoment(m, format) {
-
     if (!m.isValid()) {
-      return m.lang().invalidDate();
+      return m.localeData().invalidDate();
     }
 
-    format = expandFormat(format, m.lang());
-
-    if (!formatFunctions[format]) {
-      formatFunctions[format] = makeFormatFunction(format);
-    }
+    format = expandFormat(format, m.localeData());
+    formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);
 
     return formatFunctions[format](m);
   }
 
-  function expandFormat(format, lang) {
+  function expandFormat(format, locale) {
     var i = 5;
 
     function replaceLongDateFormatTokens(input) {
-      return lang.longDateFormat(input) || input;
+      return locale.longDateFormat(input) || input;
     }
 
     localFormattingTokens.lastIndex = 0;
@@ -941,493 +501,343 @@
     return format;
   }
 
+  var match1         = /\d/;            //       0 - 9
+  var match2         = /\d\d/;          //      00 - 99
+  var match3         = /\d{3}/;         //     000 - 999
+  var match4         = /\d{4}/;         //    0000 - 9999
+  var match6         = /[+-]?\d{6}/;    // -999999 - 999999
+  var match1to2      = /\d\d?/;         //       0 - 99
+  var match1to3      = /\d{1,3}/;       //       0 - 999
+  var match1to4      = /\d{1,4}/;       //       0 - 9999
+  var match1to6      = /[+-]?\d{1,6}/;  // -999999 - 999999
 
-  /************************************
-   Parsing
-   ************************************/
-
-
-    // get the regex to find the next token
-  function getParseRegexForToken(token, config) {
-    var a, strict = config._strict;
-    switch (token) {
-      case 'DDDD':
-        return parseTokenThreeDigits;
-      case 'YYYY':
-      case 'GGGG':
-      case 'gggg':
-        return strict ? parseTokenFourDigits : parseTokenOneToFourDigits;
-      case 'Y':
-      case 'G':
-      case 'g':
-        return parseTokenSignedNumber;
-      case 'YYYYYY':
-      case 'YYYYY':
-      case 'GGGGG':
-      case 'ggggg':
-        return strict ? parseTokenSixDigits : parseTokenOneToSixDigits;
-      case 'S':
-        if (strict) { return parseTokenOneDigit; }
-      /* falls through */
-      case 'SS':
-        if (strict) { return parseTokenTwoDigits; }
-      /* falls through */
-      case 'SSS':
-        if (strict) { return parseTokenThreeDigits; }
-      /* falls through */
-      case 'DDD':
-        return parseTokenOneToThreeDigits;
-      case 'MMM':
-      case 'MMMM':
-      case 'dd':
-      case 'ddd':
-      case 'dddd':
-        return parseTokenWord;
-      case 'a':
-      case 'A':
-        return getLangDefinition(config._l)._meridiemParse;
-      case 'X':
-        return parseTokenTimestampMs;
-      case 'Z':
-      case 'ZZ':
-        return parseTokenTimezone;
-      case 'T':
-        return parseTokenT;
-      case 'SSSS':
-        return parseTokenDigits;
-      case 'MM':
-      case 'DD':
-      case 'YY':
-      case 'GG':
-      case 'gg':
-      case 'HH':
-      case 'hh':
-      case 'mm':
-      case 'ss':
-      case 'ww':
-      case 'WW':
-        return strict ? parseTokenTwoDigits : parseTokenOneOrTwoDigits;
-      case 'M':
-      case 'D':
-      case 'd':
-      case 'H':
-      case 'h':
-      case 'm':
-      case 's':
-      case 'w':
-      case 'W':
-      case 'e':
-      case 'E':
-        return parseTokenOneOrTwoDigits;
-      default :
-        a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\', '')), "i"));
-        return a;
-    }
-  }
-
-  function timezoneMinutesFromString(string) {
-    string = string || "";
-    var possibleTzMatches = (string.match(parseTokenTimezone) || []),
-      tzChunk = possibleTzMatches[possibleTzMatches.length - 1] || [],
-      parts = (tzChunk + '').match(parseTimezoneChunker) || ['-', 0, 0],
-      minutes = +(parts[1] * 60) + toInt(parts[2]);
-
-    return parts[0] === '+' ? -minutes : minutes;
-  }
-
-  // function to convert string input to date
-  function addTimeToArrayFromToken(token, input, config) {
-    var a, datePartArray = config._a;
-
-    switch (token) {
-      // MONTH
-      case 'M' : // fall through to MM
-      case 'MM' :
-        if (input != null) {
-          datePartArray[MONTH] = toInt(input) - 1;
-        }
-        break;
-      case 'MMM' : // fall through to MMMM
-      case 'MMMM' :
-        a = getLangDefinition(config._l).monthsParse(input);
-        // if we didn't find a month name, mark the date as invalid.
-        if (a != null) {
-          datePartArray[MONTH] = a;
-        } else {
-          config._pf.invalidMonth = input;
-        }
-        break;
-      // DAY OF MONTH
-      case 'D' : // fall through to DD
-      case 'DD' :
-        if (input != null) {
-          datePartArray[DATE] = toInt(input);
-        }
-        break;
-      // DAY OF YEAR
-      case 'DDD' : // fall through to DDDD
-      case 'DDDD' :
-        if (input != null) {
-          config._dayOfYear = toInt(input);
-        }
-
-        break;
-      // YEAR
-      case 'YY' :
-        datePartArray[YEAR] = toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
-        break;
-      case 'YYYY' :
-      case 'YYYYY' :
-      case 'YYYYYY' :
-        datePartArray[YEAR] = toInt(input);
-        break;
-      // AM / PM
-      case 'a' : // fall through to A
-      case 'A' :
-        config._isPm = getLangDefinition(config._l).isPM(input);
-        break;
-      // 24 HOUR
-      case 'H' : // fall through to hh
-      case 'HH' : // fall through to hh
-      case 'h' : // fall through to hh
-      case 'hh' :
-        datePartArray[HOUR] = toInt(input);
-        break;
-      // MINUTE
-      case 'm' : // fall through to mm
-      case 'mm' :
-        datePartArray[MINUTE] = toInt(input);
-        break;
-      // SECOND
-      case 's' : // fall through to ss
-      case 'ss' :
-        datePartArray[SECOND] = toInt(input);
-        break;
-      // MILLISECOND
-      case 'S' :
-      case 'SS' :
-      case 'SSS' :
-      case 'SSSS' :
-        datePartArray[MILLISECOND] = toInt(('0.' + input) * 1000);
-        break;
-      // UNIX TIMESTAMP WITH MS
-      case 'X':
-        config._d = new Date(parseFloat(input) * 1000);
-        break;
-      // TIMEZONE
-      case 'Z' : // fall through to ZZ
-      case 'ZZ' :
-        config._useUTC = true;
-        config._tzm = timezoneMinutesFromString(input);
-        break;
-      case 'w':
-      case 'ww':
-      case 'W':
-      case 'WW':
-      case 'd':
-      case 'dd':
-      case 'ddd':
-      case 'dddd':
-      case 'e':
-      case 'E':
-        token = token.substr(0, 1);
-      /* falls through */
-      case 'gg':
-      case 'gggg':
-      case 'GG':
-      case 'GGGG':
-      case 'GGGGG':
-        token = token.substr(0, 2);
-        if (input) {
-          config._w = config._w || {};
-          config._w[token] = input;
-        }
-        break;
-    }
-  }
-
-  // convert an array to a date.
-  // the array should mirror the parameters below
-  // note: all values past the year are optional and will default to the lowest possible value.
-  // [year, month, day , hour, minute, second, millisecond]
-  function dateFromConfig(config) {
-    var i, date, input = [], currentDate,
-      yearToUse, fixYear, w, temp, lang, weekday, week;
+  var matchUnsigned  = /\d+/;           //       0 - inf
+  var matchSigned    = /[+-]?\d+/;      //    -inf - inf
 
-    if (config._d) {
-      return;
-    }
+  var matchOffset    = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z
 
-    currentDate = currentDateArray(config);
+  var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123
 
-    //compute day of the year from weeks and weekdays
-    if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
-      fixYear = function (val) {
-        var int_val = parseInt(val, 10);
-        return val ?
-          (val.length < 3 ? (int_val > 68 ? 1900 + int_val : 2000 + int_val) : int_val) :
-          (config._a[YEAR] == null ? moment().weekYear() : config._a[YEAR]);
-      };
+  // any word (or two) characters or numbers including two/three word month in arabic.
+  var matchWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i;
 
-      w = config._w;
-      if (w.GG != null || w.W != null || w.E != null) {
-        temp = dayOfYearFromWeeks(fixYear(w.GG), w.W || 1, w.E, 4, 1);
-      }
-      else {
-        lang = getLangDefinition(config._l);
-        weekday = w.d != null ?  parseWeekday(w.d, lang) :
-          (w.e != null ?  parseInt(w.e, 10) + lang._week.dow : 0);
+  var regexes = {};
 
-        week = parseInt(w.w, 10) || 1;
+  function isFunction (sth) {
+    // https://github.com/moment/moment/issues/2325
+    return typeof sth === 'function' &&
+      Object.prototype.toString.call(sth) === '[object Function]';
+  }
 
-        //if we're parsing 'd', then the low day numbers may be next week
-        if (w.d != null && weekday < lang._week.dow) {
-          week++;
-        }
 
-        temp = dayOfYearFromWeeks(fixYear(w.gg), week, weekday, lang._week.doy, lang._week.dow);
-      }
+  function addRegexToken (token, regex, strictRegex) {
+    regexes[token] = isFunction(regex) ? regex : function (isStrict) {
+      return (isStrict && strictRegex) ? strictRegex : regex;
+    };
+  }
 
-      config._a[YEAR] = temp.year;
-      config._dayOfYear = temp.dayOfYear;
+  function getParseRegexForToken (token, config) {
+    if (!hasOwnProp(regexes, token)) {
+      return new RegExp(unescapeFormat(token));
     }
 
-    //if the day of the year is set, figure out what it is
-    if (config._dayOfYear) {
-      yearToUse = config._a[YEAR] == null ? currentDate[YEAR] : config._a[YEAR];
+    return regexes[token](config._strict, config._locale);
+  }
 
-      if (config._dayOfYear > daysInYear(yearToUse)) {
-        config._pf._overflowDayOfYear = true;
-      }
+  // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
+  function unescapeFormat(s) {
+    return s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
+      return p1 || p2 || p3 || p4;
+    }).replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
+  }
 
-      date = makeUTCDate(yearToUse, 0, config._dayOfYear);
-      config._a[MONTH] = date.getUTCMonth();
-      config._a[DATE] = date.getUTCDate();
-    }
+  var tokens = {};
 
-    // Default to current date.
-    // * if no year, month, day of month are given, default to today
-    // * if day of month is given, default month and year
-    // * if month is given, default only year
-    // * if year is given, don't default anything
-    for (i = 0; i < 3 && config._a[i] == null; ++i) {
-      config._a[i] = input[i] = currentDate[i];
+  function addParseToken (token, callback) {
+    var i, func = callback;
+    if (typeof token === 'string') {
+      token = [token];
+    }
+    if (typeof callback === 'number') {
+      func = function (input, array) {
+        array[callback] = toInt(input);
+      };
+    }
+    for (i = 0; i < token.length; i++) {
+      tokens[token[i]] = func;
     }
+  }
 
-    // Zero out whatever was not defaulted, including time
-    for (; i < 7; i++) {
-      config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
+  function addWeekParseToken (token, callback) {
+    addParseToken(token, function (input, array, config, token) {
+      config._w = config._w || {};
+      callback(input, config._w, config, token);
+    });
+  }
+
+  function addTimeToArrayFromToken(token, input, config) {
+    if (input != null && hasOwnProp(tokens, token)) {
+      tokens[token](input, config._a, config, token);
     }
+  }
 
-    // add the offsets to the time to be parsed so that we can have a clean array for checking isValid
-    input[HOUR] += toInt((config._tzm || 0) / 60);
-    input[MINUTE] += toInt((config._tzm || 0) % 60);
+  var YEAR = 0;
+  var MONTH = 1;
+  var DATE = 2;
+  var HOUR = 3;
+  var MINUTE = 4;
+  var SECOND = 5;
+  var MILLISECOND = 6;
 
-    config._d = (config._useUTC ? makeUTCDate : makeDate).apply(null, input);
+  function daysInMonth(year, month) {
+    return new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
   }
 
-  function dateFromObject(config) {
-    var normalizedInput;
+  // FORMATTING
 
-    if (config._d) {
-      return;
-    }
+  addFormatToken('M', ['MM', 2], 'Mo', function () {
+    return this.month() + 1;
+  });
+
+  addFormatToken('MMM', 0, 0, function (format) {
+    return this.localeData().monthsShort(this, format);
+  });
 
-    normalizedInput = normalizeObjectUnits(config._i);
-    config._a = [
-      normalizedInput.year,
-      normalizedInput.month,
-      normalizedInput.day,
-      normalizedInput.hour,
-      normalizedInput.minute,
-      normalizedInput.second,
-      normalizedInput.millisecond
-    ];
+  addFormatToken('MMMM', 0, 0, function (format) {
+    return this.localeData().months(this, format);
+  });
 
-    dateFromConfig(config);
-  }
+  // ALIASES
 
-  function currentDateArray(config) {
-    var now = new Date();
-    if (config._useUTC) {
-      return [
-        now.getUTCFullYear(),
-        now.getUTCMonth(),
-        now.getUTCDate()
-      ];
+  addUnitAlias('month', 'M');
+
+  // PARSING
+
+  addRegexToken('M',    match1to2);
+  addRegexToken('MM',   match1to2, match2);
+  addRegexToken('MMM',  matchWord);
+  addRegexToken('MMMM', matchWord);
+
+  addParseToken(['M', 'MM'], function (input, array) {
+    array[MONTH] = toInt(input) - 1;
+  });
+
+  addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
+    var month = config._locale.monthsParse(input, token, config._strict);
+    // if we didn't find a month name, mark the date as invalid.
+    if (month != null) {
+      array[MONTH] = month;
     } else {
-      return [now.getFullYear(), now.getMonth(), now.getDate()];
+      getParsingFlags(config).invalidMonth = input;
     }
-  }
+  });
 
-  // date from string and format string
-  function makeDateFromStringAndFormat(config) {
+  // LOCALES
 
-    config._a = [];
-    config._pf.empty = true;
+  var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_');
+  function localeMonths (m) {
+    return this._months[m.month()];
+  }
 
-    // This array is used to make a Date, either with `new Date` or `Date.UTC`
-    var lang = getLangDefinition(config._l),
-      string = '' + config._i,
-      i, parsedInput, tokens, token, skipped,
-      stringLength = string.length,
-      totalParsedInputLength = 0;
+  var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_');
+  function localeMonthsShort (m) {
+    return this._monthsShort[m.month()];
+  }
 
-    tokens = expandFormat(config._f, lang).match(formattingTokens) || [];
+  function localeMonthsParse (monthName, format, strict) {
+    var i, mom, regex;
 
-    for (i = 0; i < tokens.length; i++) {
-      token = tokens[i];
-      parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];
-      if (parsedInput) {
-        skipped = string.substr(0, string.indexOf(parsedInput));
-        if (skipped.length > 0) {
-          config._pf.unusedInput.push(skipped);
-        }
-        string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
-        totalParsedInputLength += parsedInput.length;
+    if (!this._monthsParse) {
+      this._monthsParse = [];
+      this._longMonthsParse = [];
+      this._shortMonthsParse = [];
+    }
+
+    for (i = 0; i < 12; i++) {
+      // make the regex if we don't have it already
+      mom = create_utc__createUTC([2000, i]);
+      if (strict && !this._longMonthsParse[i]) {
+        this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i');
+        this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i');
       }
-      // don't parse if it's not a known token
-      if (formatTokenFunctions[token]) {
-        if (parsedInput) {
-          config._pf.empty = false;
-        }
-        else {
-          config._pf.unusedTokens.push(token);
-        }
-        addTimeToArrayFromToken(token, parsedInput, config);
+      if (!strict && !this._monthsParse[i]) {
+        regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
+        this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
       }
-      else if (config._strict && !parsedInput) {
-        config._pf.unusedTokens.push(token);
+      // test the regex
+      if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) {
+        return i;
+      } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) {
+        return i;
+      } else if (!strict && this._monthsParse[i].test(monthName)) {
+        return i;
       }
     }
+  }
 
-    // add remaining unparsed input length to the string
-    config._pf.charsLeftOver = stringLength - totalParsedInputLength;
-    if (string.length > 0) {
-      config._pf.unusedInput.push(string);
-    }
+  // MOMENTS
 
-    // handle am pm
-    if (config._isPm && config._a[HOUR] < 12) {
-      config._a[HOUR] += 12;
-    }
-    // if is 12 am, change hours to 0
-    if (config._isPm === false && config._a[HOUR] === 12) {
-      config._a[HOUR] = 0;
+  function setMonth (mom, value) {
+    var dayOfMonth;
+
+    // TODO: Move this out of here!
+    if (typeof value === 'string') {
+      value = mom.localeData().monthsParse(value);
+      // TODO: Another silent failure?
+      if (typeof value !== 'number') {
+        return mom;
+      }
     }
 
-    dateFromConfig(config);
-    checkOverflow(config);
+    dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
+    mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
+    return mom;
   }
 
-  function unescapeFormat(s) {
-    return s.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
-      return p1 || p2 || p3 || p4;
-    });
+  function getSetMonth (value) {
+    if (value != null) {
+      setMonth(this, value);
+      utils_hooks__hooks.updateOffset(this, true);
+      return this;
+    } else {
+      return get_set__get(this, 'Month');
+    }
   }
 
-  // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
-  function regexpEscape(s) {
-    return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
+  function getDaysInMonth () {
+    return daysInMonth(this.year(), this.month());
   }
 
-  // date from string and array of format strings
-  function makeDateFromStringAndArray(config) {
-    var tempConfig,
-      bestMoment,
+  function checkOverflow (m) {
+    var overflow;
+    var a = m._a;
 
-      scoreToBeat,
-      i,
-      currentScore;
+    if (a && getParsingFlags(m).overflow === -2) {
+      overflow =
+        a[MONTH]       < 0 || a[MONTH]       > 11  ? MONTH :
+          a[DATE]        < 1 || a[DATE]        > daysInMonth(a[YEAR], a[MONTH]) ? DATE :
+            a[HOUR]        < 0 || a[HOUR]        > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR :
+              a[MINUTE]      < 0 || a[MINUTE]      > 59  ? MINUTE :
+                a[SECOND]      < 0 || a[SECOND]      > 59  ? SECOND :
+                  a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND :
+                    -1;
 
-    if (config._f.length === 0) {
-      config._pf.invalidFormat = true;
-      config._d = new Date(NaN);
-      return;
+      if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
+        overflow = DATE;
+      }
+
+      getParsingFlags(m).overflow = overflow;
     }
 
-    for (i = 0; i < config._f.length; i++) {
-      currentScore = 0;
-      tempConfig = extend({}, config);
-      tempConfig._pf = defaultParsingFlags();
-      tempConfig._f = config._f[i];
-      makeDateFromStringAndFormat(tempConfig);
+    return m;
+  }
 
-      if (!isValid(tempConfig)) {
-        continue;
-      }
+  function warn(msg) {
+    if (utils_hooks__hooks.suppressDeprecationWarnings === false && typeof console !== 'undefined' && console.warn) {
+      console.warn('Deprecation warning: ' + msg);
+    }
+  }
 
-      // if there is any input that was not parsed add a penalty for that format
-      currentScore += tempConfig._pf.charsLeftOver;
+  function deprecate(msg, fn) {
+    var firstTime = true;
 
-      //or tokens
-      currentScore += tempConfig._pf.unusedTokens.length * 10;
+    return extend(function () {
+      if (firstTime) {
+        warn(msg + '\n' + (new Error()).stack);
+        firstTime = false;
+      }
+      return fn.apply(this, arguments);
+    }, fn);
+  }
 
-      tempConfig._pf.score = currentScore;
+  var deprecations = {};
 
-      if (scoreToBeat == null || currentScore < scoreToBeat) {
-        scoreToBeat = currentScore;
-        bestMoment = tempConfig;
-      }
+  function deprecateSimple(name, msg) {
+    if (!deprecations[name]) {
+      warn(msg);
+      deprecations[name] = true;
     }
-
-    extend(config, bestMoment || tempConfig);
   }
 
+  utils_hooks__hooks.suppressDeprecationWarnings = false;
+
+  var from_string__isoRegex = /^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
+
+  var isoDates = [
+    ['YYYYYY-MM-DD', /[+-]\d{6}-\d{2}-\d{2}/],
+    ['YYYY-MM-DD', /\d{4}-\d{2}-\d{2}/],
+    ['GGGG-[W]WW-E', /\d{4}-W\d{2}-\d/],
+    ['GGGG-[W]WW', /\d{4}-W\d{2}/],
+    ['YYYY-DDD', /\d{4}-\d{3}/]
+  ];
+
+  // iso time formats and regexes
+  var isoTimes = [
+    ['HH:mm:ss.SSSS', /(T| )\d\d:\d\d:\d\d\.\d+/],
+    ['HH:mm:ss', /(T| )\d\d:\d\d:\d\d/],
+    ['HH:mm', /(T| )\d\d:\d\d/],
+    ['HH', /(T| )\d\d/]
+  ];
+
+  var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i;
+
   // date from iso format
-  function makeDateFromString(config) {
+  function configFromISO(config) {
     var i, l,
       string = config._i,
-      match = isoRegex.exec(string);
+      match = from_string__isoRegex.exec(string);
 
     if (match) {
-      config._pf.iso = true;
+      getParsingFlags(config).iso = true;
       for (i = 0, l = isoDates.length; i < l; i++) {
         if (isoDates[i][1].exec(string)) {
-          // match[5] should be "T" or undefined
-          config._f = isoDates[i][0] + (match[6] || " ");
+          config._f = isoDates[i][0];
           break;
         }
       }
       for (i = 0, l = isoTimes.length; i < l; i++) {
         if (isoTimes[i][1].exec(string)) {
-          config._f += isoTimes[i][0];
+          // match[6] should be 'T' or space
+          config._f += (match[6] || ' ') + isoTimes[i][0];
           break;
         }
       }
-      if (string.match(parseTokenTimezone)) {
-        config._f += "Z";
+      if (string.match(matchOffset)) {
+        config._f += 'Z';
       }
-      makeDateFromStringAndFormat(config);
-    }
-    else {
-      config._d = new Date(string);
+      configFromStringAndFormat(config);
+    } else {
+      config._isValid = false;
     }
   }
 
-  function makeDateFromInput(config) {
-    var input = config._i,
-      matched = aspNetJsonRegex.exec(input);
+  // date from iso format or fallback
+  function configFromString(config) {
+    var matched = aspNetJsonRegex.exec(config._i);
 
-    if (input === undefined) {
-      config._d = new Date();
-    } else if (matched) {
+    if (matched !== null) {
       config._d = new Date(+matched[1]);
-    } else if (typeof input === 'string') {
-      makeDateFromString(config);
-    } else if (isArray(input)) {
-      config._a = input.slice(0);
-      dateFromConfig(config);
-    } else if (isDate(input)) {
-      config._d = new Date(+input);
-    } else if (typeof(input) === 'object') {
-      dateFromObject(config);
-    } else {
-      config._d = new Date(input);
+      return;
+    }
+
+    configFromISO(config);
+    if (config._isValid === false) {
+      delete config._isValid;
+      utils_hooks__hooks.createFromInputFallback(config);
     }
   }
 
-  function makeDate(y, m, d, h, M, s, ms) {
+  utils_hooks__hooks.createFromInputFallback = deprecate(
+    'moment construction falls back to js Date. This is ' +
+    'discouraged and will be removed in upcoming major ' +
+    'release. Please refer to ' +
+    'https://github.com/moment/moment/issues/1407 for more info.',
+    function (config) {
+      config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
+    }
+  );
+
+  function createDate (y, m, d, h, M, s, ms) {
     //can't just apply() to create a date:
     //http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply
     var date = new Date(y, m, d, h, M, s, ms);
@@ -1439,7 +849,7 @@
     return date;
   }
 
-  function makeUTCDate(y) {
+  function createUTCDate (y) {
     var date = new Date(Date.UTC.apply(null, arguments));
     if (y < 1970) {
       date.setUTCFullYear(y);
@@ -1447,66 +857,86 @@
     return date;
   }
 
-  function parseWeekday(input, language) {
-    if (typeof input === 'string') {
-      if (!isNaN(input)) {
-        input = parseInt(input, 10);
-      }
-      else {
-        input = language.weekdaysParse(input);
-        if (typeof input !== 'number') {
-          return null;
-        }
-      }
-    }
-    return input;
-  }
+  addFormatToken(0, ['YY', 2], 0, function () {
+    return this.year() % 100;
+  });
+
+  addFormatToken(0, ['YYYY',   4],       0, 'year');
+  addFormatToken(0, ['YYYYY',  5],       0, 'year');
+  addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
+
+  // ALIASES
+
+  addUnitAlias('year', 'y');
+
+  // PARSING
+
+  addRegexToken('Y',      matchSigned);
+  addRegexToken('YY',     match1to2, match2);
+  addRegexToken('YYYY',   match1to4, match4);
+  addRegexToken('YYYYY',  match1to6, match6);
+  addRegexToken('YYYYYY', match1to6, match6);
+
+  addParseToken(['YYYYY', 'YYYYYY'], YEAR);
+  addParseToken('YYYY', function (input, array) {
+    array[YEAR] = input.length === 2 ? utils_hooks__hooks.parseTwoDigitYear(input) : toInt(input);
+  });
+  addParseToken('YY', function (input, array) {
+    array[YEAR] = utils_hooks__hooks.parseTwoDigitYear(input);
+  });
 
-  /************************************
-   Relative Time
-   ************************************/
+  // HELPERS
 
+  function daysInYear(year) {
+    return isLeapYear(year) ? 366 : 365;
+  }
 
-    // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
-  function substituteTimeAgo(string, number, withoutSuffix, isFuture, lang) {
-    return lang.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
+  function isLeapYear(year) {
+    return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
   }
 
-  function relativeTime(milliseconds, withoutSuffix, lang) {
-    var seconds = round(Math.abs(milliseconds) / 1000),
-      minutes = round(seconds / 60),
-      hours = round(minutes / 60),
-      days = round(hours / 24),
-      years = round(days / 365),
-      args = seconds < 45 && ['s', seconds] ||
-        minutes === 1 && ['m'] ||
-        minutes < 45 && ['mm', minutes] ||
-        hours === 1 && ['h'] ||
-        hours < 22 && ['hh', hours] ||
-        days === 1 && ['d'] ||
-        days <= 25 && ['dd', days] ||
-        days <= 45 && ['M'] ||
-        days < 345 && ['MM', round(days / 30)] ||
-        years === 1 && ['y'] || ['yy', years];
-    args[2] = withoutSuffix;
-    args[3] = milliseconds > 0;
-    args[4] = lang;
-    return substituteTimeAgo.apply({}, args);
+  // HOOKS
+
+  utils_hooks__hooks.parseTwoDigitYear = function (input) {
+    return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
+  };
+
+  // MOMENTS
+
+  var getSetYear = makeGetSet('FullYear', false);
+
+  function getIsLeapYear () {
+    return isLeapYear(this.year());
   }
 
+  addFormatToken('w', ['ww', 2], 'wo', 'week');
+  addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
+
+  // ALIASES
 
-  /************************************
-   Week of Year
-   ************************************/
+  addUnitAlias('week', 'w');
+  addUnitAlias('isoWeek', 'W');
+
+  // PARSING
+
+  addRegexToken('w',  match1to2);
+  addRegexToken('ww', match1to2, match2);
+  addRegexToken('W',  match1to2);
+  addRegexToken('WW', match1to2, match2);
+
+  addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) {
+    week[token.substr(0, 1)] = toInt(input);
+  });
 
+  // HELPERS
 
-    // firstDayOfWeek       0 = sun, 6 = sat
-    //                      the day of the week that starts the week
-    //                      (usually sunday or monday)
-    // firstDayOfWeekOfYear 0 = sun, 6 = sat
-    //                      the first week is the week that contains the first
-    //                      of this day of the week
-    //                      (eg. ISO weeks use thursday (4))
+  // firstDayOfWeek       0 = sun, 6 = sat
+  //                      the day of the week that starts the week
+  //                      (usually sunday or monday)
+  // firstDayOfWeekOfYear 0 = sun, 6 = sat
+  //                      the first week is the week that contains the first
+  //                      of this day of the week
+  //                      (eg. ISO weeks use thursday (4))
   function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {
     var end = firstDayOfWeekOfYear - firstDayOfWeek,
       daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),
@@ -1521,6248 +951,2245 @@
       daysToDayOfWeek += 7;
     }
 
-    adjustedMoment = moment(mom).add('d', daysToDayOfWeek);
+    adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');
     return {
       week: Math.ceil(adjustedMoment.dayOfYear() / 7),
       year: adjustedMoment.year()
     };
   }
 
-  //http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
-  function dayOfYearFromWeeks(year, week, weekday, firstDayOfWeekOfYear, firstDayOfWeek) {
-    var d = makeUTCDate(year, 0, 1).getUTCDay(), daysToAdd, dayOfYear;
+  // LOCALES
 
-    weekday = weekday != null ? weekday : firstDayOfWeek;
-    daysToAdd = firstDayOfWeek - d + (d > firstDayOfWeekOfYear ? 7 : 0) - (d < firstDayOfWeek ? 7 : 0);
-    dayOfYear = 7 * (week - 1) + (weekday - firstDayOfWeek) + daysToAdd + 1;
-
-    return {
-      year: dayOfYear > 0 ? year : year - 1,
-      dayOfYear: dayOfYear > 0 ?  dayOfYear : daysInYear(year - 1) + dayOfYear
-    };
+  function localeWeek (mom) {
+    return weekOfYear(mom, this._week.dow, this._week.doy).week;
   }
 
-  /************************************
-   Top Level Functions
-   ************************************/
+  var defaultLocaleWeek = {
+    dow : 0, // Sunday is the first day of the week.
+    doy : 6  // The week that contains Jan 1st is the first week of the year.
+  };
 
-  function makeMoment(config) {
-    var input = config._i,
-      format = config._f;
-
-    if (input === null) {
-      return moment.invalid({nullInput: true});
-    }
-
-    if (typeof input === 'string') {
-      config._i = input = getLangDefinition().preparse(input);
-    }
-
-    if (moment.isMoment(input)) {
-      config = cloneMoment(input);
-
-      config._d = new Date(+input._d);
-    } else if (format) {
-      if (isArray(format)) {
-        makeDateFromStringAndArray(config);
-      } else {
-        makeDateFromStringAndFormat(config);
-      }
-    } else {
-      makeDateFromInput(config);
-    }
-
-    return new Moment(config);
+  function localeFirstDayOfWeek () {
+    return this._week.dow;
   }
 
-  moment = function (input, format, lang, strict) {
-    var c;
+  function localeFirstDayOfYear () {
+    return this._week.doy;
+  }
 
-    if (typeof(lang) === "boolean") {
-      strict = lang;
-      lang = undefined;
-    }
-    // object construction must be done this way.
-    // https://github.com/moment/moment/issues/1423
-    c = {};
-    c._isAMomentObject = true;
-    c._i = input;
-    c._f = format;
-    c._l = lang;
-    c._strict = strict;
-    c._isUTC = false;
-    c._pf = defaultParsingFlags();
+  // MOMENTS
 
-    return makeMoment(c);
-  };
+  function getSetWeek (input) {
+    var week = this.localeData().week(this);
+    return input == null ? week : this.add((input - week) * 7, 'd');
+  }
 
-  // creating with utc
-  moment.utc = function (input, format, lang, strict) {
-    var c;
+  function getSetISOWeek (input) {
+    var week = weekOfYear(this, 1, 4).week;
+    return input == null ? week : this.add((input - week) * 7, 'd');
+  }
 
-    if (typeof(lang) === "boolean") {
-      strict = lang;
-      lang = undefined;
-    }
-    // object construction must be done this way.
-    // https://github.com/moment/moment/issues/1423
-    c = {};
-    c._isAMomentObject = true;
-    c._useUTC = true;
-    c._isUTC = true;
-    c._l = lang;
-    c._i = input;
-    c._f = format;
-    c._strict = strict;
-    c._pf = defaultParsingFlags();
+  addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
 
-    return makeMoment(c).utc();
-  };
+  // ALIASES
 
-  // creating with unix timestamp (in seconds)
-  moment.unix = function (input) {
-    return moment(input * 1000);
-  };
+  addUnitAlias('dayOfYear', 'DDD');
 
-  // duration
-  moment.duration = function (input, key) {
-    var duration = input,
-    // matching against regexp is expensive, do it on demand
-      match = null,
-      sign,
-      ret,
-      parseIso;
+  // PARSING
 
-    if (moment.isDuration(input)) {
-      duration = {
-        ms: input._milliseconds,
-        d: input._days,
-        M: input._months
-      };
-    } else if (typeof input === 'number') {
-      duration = {};
-      if (key) {
-        duration[key] = input;
-      } else {
-        duration.milliseconds = input;
-      }
-    } else if (!!(match = aspNetTimeSpanJsonRegex.exec(input))) {
-      sign = (match[1] === "-") ? -1 : 1;
-      duration = {
-        y: 0,
-        d: toInt(match[DATE]) * sign,
-        h: toInt(match[HOUR]) * sign,
-        m: toInt(match[MINUTE]) * sign,
-        s: toInt(match[SECOND]) * sign,
-        ms: toInt(match[MILLISECOND]) * sign
-      };
-    } else if (!!(match = isoDurationRegex.exec(input))) {
-      sign = (match[1] === "-") ? -1 : 1;
-      parseIso = function (inp) {
-        // We'd normally use ~~inp for this, but unfortunately it also
-        // converts floats to ints.
-        // inp may be undefined, so careful calling replace on it.
-        var res = inp && parseFloat(inp.replace(',', '.'));
-        // apply sign while we're at it
-        return (isNaN(res) ? 0 : res) * sign;
-      };
-      duration = {
-        y: parseIso(match[2]),
-        M: parseIso(match[3]),
-        d: parseIso(match[4]),
-        h: parseIso(match[5]),
-        m: parseIso(match[6]),
-        s: parseIso(match[7]),
-        w: parseIso(match[8])
-      };
-    }
+  addRegexToken('DDD',  match1to3);
+  addRegexToken('DDDD', match3);
+  addParseToken(['DDD', 'DDDD'], function (input, array, config) {
+    config._dayOfYear = toInt(input);
+  });
 
-    ret = new Duration(duration);
+  // HELPERS
 
-    if (moment.isDuration(input) && input.hasOwnProperty('_lang')) {
-      ret._lang = input._lang;
+  //http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
+  function dayOfYearFromWeeks(year, week, weekday, firstDayOfWeekOfYear, firstDayOfWeek) {
+    var week1Jan = 6 + firstDayOfWeek - firstDayOfWeekOfYear, janX = createUTCDate(year, 0, 1 + week1Jan), d = janX.getUTCDay(), dayOfYear;
+    if (d < firstDayOfWeek) {
+      d += 7;
     }
 
-    return ret;
-  };
+    weekday = weekday != null ? 1 * weekday : firstDayOfWeek;
 
-  // version number
-  moment.version = VERSION;
+    dayOfYear = 1 + week1Jan + 7 * (week - 1) - d + weekday;
 
-  // default format
-  moment.defaultFormat = isoFormat;
+    return {
+      year: dayOfYear > 0 ? year : year - 1,
+      dayOfYear: dayOfYear > 0 ?  dayOfYear : daysInYear(year - 1) + dayOfYear
+    };
+  }
 
-  // This function will be called whenever a moment is mutated.
-  // It is intended to keep the offset in sync with the timezone.
-  moment.updateOffset = function () {};
+  // MOMENTS
 
-  // This function will load languages and then set the global language.  If
-  // no arguments are passed in, it will simply return the current global
-  // language key.
-  moment.lang = function (key, values) {
-    var r;
-    if (!key) {
-      return moment.fn._lang._abbr;
-    }
-    if (values) {
-      loadLang(normalizeLanguage(key), values);
-    } else if (values === null) {
-      unloadLang(key);
-      key = 'en';
-    } else if (!languages[key]) {
-      getLangDefinition(key);
-    }
-    r = moment.duration.fn._lang = moment.fn._lang = getLangDefinition(key);
-    return r._abbr;
-  };
+  function getSetDayOfYear (input) {
+    var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1;
+    return input == null ? dayOfYear : this.add((input - dayOfYear), 'd');
+  }
 
-  // returns language data
-  moment.langData = function (key) {
-    if (key && key._lang && key._lang._abbr) {
-      key = key._lang._abbr;
+  // Pick the first defined of two or three arguments.
+  function defaults(a, b, c) {
+    if (a != null) {
+      return a;
     }
-    return getLangDefinition(key);
-  };
-
-  // compare moment object
-  moment.isMoment = function (obj) {
-    return obj instanceof Moment ||
-      (obj != null &&  obj.hasOwnProperty('_isAMomentObject'));
-  };
-
-  // for typechecking Duration objects
-  moment.isDuration = function (obj) {
-    return obj instanceof Duration;
-  };
+    if (b != null) {
+      return b;
+    }
+    return c;
+  }
 
-  for (i = lists.length - 1; i >= 0; --i) {
-    makeList(lists[i]);
+  function currentDateArray(config) {
+    var now = new Date();
+    if (config._useUTC) {
+      return [now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate()];
+    }
+    return [now.getFullYear(), now.getMonth(), now.getDate()];
   }
 
-  moment.normalizeUnits = function (units) {
-    return normalizeUnits(units);
-  };
+  // convert an array to a date.
+  // the array should mirror the parameters below
+  // note: all values past the year are optional and will default to the lowest possible value.
+  // [year, month, day , hour, minute, second, millisecond]
+  function configFromArray (config) {
+    var i, date, input = [], currentDate, yearToUse;
 
-  moment.invalid = function (flags) {
-    var m = moment.utc(NaN);
-    if (flags != null) {
-      extend(m._pf, flags);
+    if (config._d) {
+      return;
     }
-    else {
-      m._pf.userInvalidated = true;
+
+    currentDate = currentDateArray(config);
+
+    //compute day of the year from weeks and weekdays
+    if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
+      dayOfYearFromWeekInfo(config);
     }
 
-    return m;
-  };
+    //if the day of the year is set, figure out what it is
+    if (config._dayOfYear) {
+      yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
 
-  moment.parseZone = function (input) {
-    return moment(input).parseZone();
-  };
+      if (config._dayOfYear > daysInYear(yearToUse)) {
+        getParsingFlags(config)._overflowDayOfYear = true;
+      }
 
-  /************************************
-   Moment Prototype
-   ************************************/
+      date = createUTCDate(yearToUse, 0, config._dayOfYear);
+      config._a[MONTH] = date.getUTCMonth();
+      config._a[DATE] = date.getUTCDate();
+    }
 
+    // Default to current date.
+    // * if no year, month, day of month are given, default to today
+    // * if day of month is given, default month and year
+    // * if month is given, default only year
+    // * if year is given, don't default anything
+    for (i = 0; i < 3 && config._a[i] == null; ++i) {
+      config._a[i] = input[i] = currentDate[i];
+    }
 
-  extend(moment.fn = Moment.prototype, {
+    // Zero out whatever was not defaulted, including time
+    for (; i < 7; i++) {
+      config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
+    }
 
-    clone : function () {
-      return moment(this);
-    },
+    // Check for 24:00:00.000
+    if (config._a[HOUR] === 24 &&
+      config._a[MINUTE] === 0 &&
+      config._a[SECOND] === 0 &&
+      config._a[MILLISECOND] === 0) {
+      config._nextDay = true;
+      config._a[HOUR] = 0;
+    }
 
-    valueOf : function () {
-      return +this._d + ((this._offset || 0) * 60000);
-    },
+    config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
+    // Apply timezone offset from input. The actual utcOffset can be changed
+    // with parseZone.
+    if (config._tzm != null) {
+      config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
+    }
 
-    unix : function () {
-      return Math.floor(+this / 1000);
-    },
+    if (config._nextDay) {
+      config._a[HOUR] = 24;
+    }
+  }
 
-    toString : function () {
-      return this.clone().lang('en').format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ");
-    },
+  function dayOfYearFromWeekInfo(config) {
+    var w, weekYear, week, weekday, dow, doy, temp;
+
+    w = config._w;
+    if (w.GG != null || w.W != null || w.E != null) {
+      dow = 1;
+      doy = 4;
+
+      // TODO: We need to take the current isoWeekYear, but that depends on
+      // how we interpret now (local, utc, fixed offset). So create
+      // a now version of current config (take local/utc/offset flags, and
+      // create now).
+      weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(local__createLocal(), 1, 4).year);
+      week = defaults(w.W, 1);
+      weekday = defaults(w.E, 1);
+    } else {
+      dow = config._locale._week.dow;
+      doy = config._locale._week.doy;
 
-    toDate : function () {
-      return this._offset ? new Date(+this) : this._d;
-    },
+      weekYear = defaults(w.gg, config._a[YEAR], weekOfYear(local__createLocal(), dow, doy).year);
+      week = defaults(w.w, 1);
 
-    toISOString : function () {
-      var m = moment(this).utc();
-      if (0 < m.year() && m.year() <= 9999) {
-        return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
+      if (w.d != null) {
+        // weekday -- low day numbers are considered next week
+        weekday = w.d;
+        if (weekday < dow) {
+          ++week;
+        }
+      } else if (w.e != null) {
+        // local weekday -- counting starts from begining of week
+        weekday = w.e + dow;
       } else {
-        return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
-      }
-    },
-
-    toArray : function () {
-      var m = this;
-      return [
-        m.year(),
-        m.month(),
-        m.date(),
-        m.hours(),
-        m.minutes(),
-        m.seconds(),
-        m.milliseconds()
-      ];
-    },
-
-    isValid : function () {
-      return isValid(this);
-    },
-
-    isDSTShifted : function () {
-
-      if (this._a) {
-        return this.isValid() && compareArrays(this._a, (this._isUTC ? moment.utc(this._a) : moment(this._a)).toArray()) > 0;
+        // default to begining of week
+        weekday = dow;
       }
+    }
+    temp = dayOfYearFromWeeks(weekYear, week, weekday, doy, dow);
 
-      return false;
-    },
+    config._a[YEAR] = temp.year;
+    config._dayOfYear = temp.dayOfYear;
+  }
 
-    parsingFlags : function () {
-      return extend({}, this._pf);
-    },
+  utils_hooks__hooks.ISO_8601 = function () {};
 
-    invalidAt: function () {
-      return this._pf.overflow;
-    },
+  // date from string and format string
+  function configFromStringAndFormat(config) {
+    // TODO: Move this to another part of the creation flow to prevent circular deps
+    if (config._f === utils_hooks__hooks.ISO_8601) {
+      configFromISO(config);
+      return;
+    }
 
-    utc : function () {
-      return this.zone(0);
-    },
+    config._a = [];
+    getParsingFlags(config).empty = true;
 
-    local : function () {
-      this.zone(0);
-      this._isUTC = false;
-      return this;
-    },
+    // This array is used to make a Date, either with `new Date` or `Date.UTC`
+    var string = '' + config._i,
+      i, parsedInput, tokens, token, skipped,
+      stringLength = string.length,
+      totalParsedInputLength = 0;
 
-    format : function (inputString) {
-      var output = formatMoment(this, inputString || moment.defaultFormat);
-      return this.lang().postformat(output);
-    },
+    tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];
 
-    add : function (input, val) {
-      var dur;
-      // switch args to support add('s', 1) and add(1, 's')
-      if (typeof input === 'string') {
-        dur = moment.duration(+val, input);
-      } else {
-        dur = moment.duration(input, val);
+    for (i = 0; i < tokens.length; i++) {
+      token = tokens[i];
+      parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];
+      if (parsedInput) {
+        skipped = string.substr(0, string.indexOf(parsedInput));
+        if (skipped.length > 0) {
+          getParsingFlags(config).unusedInput.push(skipped);
+        }
+        string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
+        totalParsedInputLength += parsedInput.length;
       }
-      addOrSubtractDurationFromMoment(this, dur, 1);
-      return this;
-    },
-
-    subtract : function (input, val) {
-      var dur;
-      // switch args to support subtract('s', 1) and subtract(1, 's')
-      if (typeof input === 'string') {
-        dur = moment.duration(+val, input);
-      } else {
-        dur = moment.duration(input, val);
+      // don't parse if it's not a known token
+      if (formatTokenFunctions[token]) {
+        if (parsedInput) {
+          getParsingFlags(config).empty = false;
+        }
+        else {
+          getParsingFlags(config).unusedTokens.push(token);
+        }
+        addTimeToArrayFromToken(token, parsedInput, config);
       }
-      addOrSubtractDurationFromMoment(this, dur, -1);
-      return this;
-    },
+      else if (config._strict && !parsedInput) {
+        getParsingFlags(config).unusedTokens.push(token);
+      }
+    }
 
-    diff : function (input, units, asFloat) {
-      var that = makeAs(input, this),
-        zoneDiff = (this.zone() - that.zone()) * 6e4,
-        diff, output;
+    // add remaining unparsed input length to the string
+    getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;
+    if (string.length > 0) {
+      getParsingFlags(config).unusedInput.push(string);
+    }
 
-      units = normalizeUnits(units);
+    // clear _12h flag if hour is <= 12
+    if (getParsingFlags(config).bigHour === true &&
+      config._a[HOUR] <= 12 &&
+      config._a[HOUR] > 0) {
+      getParsingFlags(config).bigHour = undefined;
+    }
+    // handle meridiem
+    config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);
 
-      if (units === 'year' || units === 'month') {
-        // average number of days in the months in the given dates
-        diff = (this.daysInMonth() + that.daysInMonth()) * 432e5; // 24 * 60 * 60 * 1000 / 2
-        // difference in months
-        output = ((this.year() - that.year()) * 12) + (this.month() - that.month());
-        // adjust by taking difference in days, average number of days
-        // and dst in the given months.
-        output += ((this - moment(this).startOf('month')) -
-          (that - moment(that).startOf('month'))) / diff;
-        // same as above but with zones, to negate all dst
-        output -= ((this.zone() - moment(this).startOf('month').zone()) -
-          (that.zone() - moment(that).startOf('month').zone())) * 6e4 / diff;
-        if (units === 'year') {
-          output = output / 12;
-        }
-      } else {
-        diff = (this - that);
-        output = units === 'second' ? diff / 1e3 : // 1000
-          units === 'minute' ? diff / 6e4 : // 1000 * 60
-            units === 'hour' ? diff / 36e5 : // 1000 * 60 * 60
-              units === 'day' ? (diff - zoneDiff) / 864e5 : // 1000 * 60 * 60 * 24, negate dst
-                units === 'week' ? (diff - zoneDiff) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst
-                  diff;
-      }
-      return asFloat ? output : absRound(output);
-    },
-
-    from : function (time, withoutSuffix) {
-      return moment.duration(this.diff(time)).lang(this.lang()._abbr).humanize(!withoutSuffix);
-    },
-
-    fromNow : function (withoutSuffix) {
-      return this.from(moment(), withoutSuffix);
-    },
-
-    calendar : function () {
-      // We want to compare the start of today, vs this.
-      // Getting start-of-today depends on whether we're zone'd or not.
-      var sod = makeAs(moment(), this).startOf('day'),
-        diff = this.diff(sod, 'days', true),
-        format = diff < -6 ? 'sameElse' :
-          diff < -1 ? 'lastWeek' :
-            diff < 0 ? 'lastDay' :
-              diff < 1 ? 'sameDay' :
-                diff < 2 ? 'nextDay' :
-                  diff < 7 ? 'nextWeek' : 'sameElse';
-      return this.format(this.lang().calendar(format, this));
-    },
-
-    isLeapYear : function () {
-      return isLeapYear(this.year());
-    },
-
-    isDST : function () {
-      return (this.zone() < this.clone().month(0).zone() ||
-        this.zone() < this.clone().month(5).zone());
-    },
-
-    day : function (input) {
-      var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
-      if (input != null) {
-        input = parseWeekday(input, this.lang());
-        return this.add({ d : input - day });
-      } else {
-        return day;
-      }
-    },
-
-    month : function (input) {
-      var utc = this._isUTC ? 'UTC' : '',
-        dayOfMonth;
-
-      if (input != null) {
-        if (typeof input === 'string') {
-          input = this.lang().monthsParse(input);
-          if (typeof input !== 'number') {
-            return this;
-          }
-        }
+    configFromArray(config);
+    checkOverflow(config);
+  }
 
-        dayOfMonth = this.date();
-        this.date(1);
-        this._d['set' + utc + 'Month'](input);
-        this.date(Math.min(dayOfMonth, this.daysInMonth()));
 
-        moment.updateOffset(this);
-        return this;
-      } else {
-        return this._d['get' + utc + 'Month']();
-      }
-    },
+  function meridiemFixWrap (locale, hour, meridiem) {
+    var isPm;
 
-    startOf: function (units) {
-      units = normalizeUnits(units);
-      // the following switch intentionally omits break keywords
-      // to utilize falling through the cases.
-      switch (units) {
-        case 'year':
-          this.month(0);
-        /* falls through */
-        case 'month':
-          this.date(1);
-        /* falls through */
-        case 'week':
-        case 'isoWeek':
-        case 'day':
-          this.hours(0);
-        /* falls through */
-        case 'hour':
-          this.minutes(0);
-        /* falls through */
-        case 'minute':
-          this.seconds(0);
-        /* falls through */
-        case 'second':
-          this.milliseconds(0);
-        /* falls through */
+    if (meridiem == null) {
+      // nothing to do
+      return hour;
+    }
+    if (locale.meridiemHour != null) {
+      return locale.meridiemHour(hour, meridiem);
+    } else if (locale.isPM != null) {
+      // Fallback
+      isPm = locale.isPM(meridiem);
+      if (isPm && hour < 12) {
+        hour += 12;
       }
-
-      // weeks are a special case
-      if (units === 'week') {
-        this.weekday(0);
-      } else if (units === 'isoWeek') {
-        this.isoWeekday(1);
+      if (!isPm && hour === 12) {
+        hour = 0;
       }
+      return hour;
+    } else {
+      // this is not supposed to happen
+      return hour;
+    }
+  }
 
-      return this;
-    },
+  function configFromStringAndArray(config) {
+    var tempConfig,
+      bestMoment,
 
-    endOf: function (units) {
-      units = normalizeUnits(units);
-   

<TRUNCATED>

[3/3] ambari git commit: AMBARI-13293. Ambari Web: Set/change the timezone (onechiporenko)

Posted by on...@apache.org.
AMBARI-13293. Ambari Web: Set/change the timezone (onechiporenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/deb5a06a
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/deb5a06a
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/deb5a06a

Branch: refs/heads/branch-2.1
Commit: deb5a06a4efecc3dff8c3f52b6832c690bdfddfc
Parents: 57a56c5
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Fri Oct 2 12:29:08 2015 +0300
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Fri Oct 2 12:29:08 2015 +0300

----------------------------------------------------------------------
 ambari-web/app/controllers.js                   |    1 +
 ambari-web/app/controllers/application.js       |   68 -
 .../global/background_operations_controller.js  |    4 +-
 .../controllers/global/cluster_controller.js    |    2 +-
 .../global/user_settings_controller.js          |  214 +
 ambari-web/app/controllers/installer.js         |    3 +-
 ambari-web/app/controllers/login_controller.js  |    1 +
 .../app/controllers/main/admin/kerberos.js      |    2 +-
 ambari-web/app/controllers/main/host.js         |    2 +-
 ambari-web/app/controllers/main/host/details.js |    2 +-
 ambari-web/app/controllers/main/service.js      |    6 +-
 .../controllers/main/service/info/summary.js    |    7 +-
 ambari-web/app/controllers/main/service/item.js |    8 +-
 .../mappers/alert_definition_summary_mapper.js  |    2 +-
 .../app/mappers/alert_instances_mapper.js       |    2 +
 .../mappers/service_config_version_mapper.js    |    1 +
 ambari-web/app/messages.js                      |    1 +
 ambari-web/app/mixins/common/userPref.js        |    4 +-
 ambari-web/app/templates/application.hbs        |    2 +-
 ambari-web/app/templates/common/settings.hbs    |   10 +
 .../app/utils/batch_scheduled_requests.js       |    2 +-
 ambari-web/app/utils/date.js                    |   18 +-
 ambari-web/app/utils/helper.js                  |   13 +
 ambari-web/app/utils/host_progress_popup.js     |    3 +-
 .../app/views/common/chart/linear_time.js       |  491 +-
 .../dashboard/widgets/uptime_text_widget.js     |   38 +-
 ambari-web/app/views/main/host/summary.js       |    5 +-
 .../app/views/main/service/reconfigure.js       |    2 +-
 ambari-web/config.coffee                        |    1 +
 ambari-web/test/controllers/application_test.js |   94 +-
 .../global/user_settings_controller_test.js     |   74 +
 .../test/controllers/main/host/details_test.js  |    2 +-
 .../widgets/hbase_master_uptime_test.js         |   42 +-
 .../moment-timezone-with-data-2010-2020.js      | 1015 ++
 ambari-web/vendor/scripts/moment.js             | 9961 +++++-------------
 35 files changed, 4358 insertions(+), 7745 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/app/controllers.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers.js b/ambari-web/app/controllers.js
index 12f1753..ae037c0 100644
--- a/ambari-web/app/controllers.js
+++ b/ambari-web/app/controllers.js
@@ -25,6 +25,7 @@ require('controllers/wizard');
 require('controllers/installer');
 require('controllers/experimental');
 require('controllers/global/background_operations_controller');
+require('controllers/global/user_settings_controller');
 require('controllers/main');
 require('controllers/main/dashboard');
 require('controllers/main/dashboard/config_history_controller');

http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/app/controllers/application.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/application.js b/ambari-web/app/controllers/application.js
index 23ff4dc..0f30a62 100644
--- a/ambari-web/app/controllers/application.js
+++ b/ambari-web/app/controllers/application.js
@@ -81,78 +81,10 @@ App.ApplicationController = Em.Controller.extend(App.UserPref, {
     });
   },
 
-  dataLoading: function () {
-    var dfd = $.Deferred();
-    var self = this;
-    this.getUserPref(this.persistKey()).complete(function () {
-      var curPref = self.get('currentPrefObject');
-      self.set('currentPrefObject', null);
-      dfd.resolve(curPref);
-    });
-    return dfd.promise();
-  },
-  persistKey: function (loginName) {
-    if (App.get('testMode')) {
-      return 'admin_settings_show_bg';
-    }
-    if (!loginName)
-      loginName = App.router.get('loginName');
-    return 'admin-settings-show-bg-' + loginName;
-  },
-  currentPrefObject: null,
-
-  getUserPrefSuccessCallback: function (response, request, data) {
-    if (response != null) {
-      console.log('Got persist value from server with key ' + data.key + '. Value is: ' + response);
-      this.set('currentPrefObject', response);
-      return response;
-    }
-  },
-  getUserPrefErrorCallback: function (request, ajaxOptions, error) {
-    // this user is first time login
-    if (request.status == 404) {
-      console.log('Persist did NOT find the key');
-      this.set('currentPrefObject', true);
-      this.postUserPref(this.persistKey(), true);
-      return true;
-    }
-  },
-
   goToAdminView: function () {
     App.router.route("adminView");
   },
 
-  showSettingsPopup: function() {
-    // Settings only for admins
-    if (!App.isAccessible('upgrade_ADMIN')) return;
-
-    var self = this;
-    var curValue = null;
-    this.dataLoading().done(function (initValue) {
-      App.ModalPopup.show({
-        header: Em.I18n.t('common.userSettings'),
-        bodyClass: Em.View.extend({
-          templateName: require('templates/common/settings'),
-          isNotShowBgChecked: !initValue,
-          updateValue: function () {
-            curValue = !this.get('isNotShowBgChecked');
-          }.observes('isNotShowBgChecked')
-        }),
-        primary: Em.I18n.t('common.save'),
-        onPrimary: function() {
-          if (curValue == null) {
-            curValue = initValue;
-          }
-          var key = self.persistKey();
-          if (!App.get('testMode')) {
-            self.postUserPref(key, curValue);
-          }
-          this.hide();
-        }
-      })
-    });
-  },
-
   showAboutPopup: function() {
 
     var self = this;

http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/app/controllers/global/background_operations_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/background_operations_controller.js b/ambari-web/app/controllers/global/background_operations_controller.js
index 22e1e90..2cc3057 100644
--- a/ambari-web/app/controllers/global/background_operations_controller.js
+++ b/ambari-web/app/controllers/global/background_operations_controller.js
@@ -158,7 +158,7 @@ App.BackgroundOperationsController = Em.Controller.extend({
     if (request.get('isRunning')) {
       request.set('progress', App.HostPopup.getProgress(data.tasks));
       request.set('status', App.HostPopup.getStatus(data.tasks)[0]);
-      request.set('isRunning', (request.get('progress') !== 100));
+      request.set('isRunning', request.get('progress') !== 100);
     }
     request.set('previousTaskStatusMap', currentTaskStatusMap);
     request.set('hostsMap', hostsMap);
@@ -353,7 +353,7 @@ App.BackgroundOperationsController = Em.Controller.extend({
   showPopup: function(){
     // load the checkbox on footer first, then show popup.
     var self = this;
-    App.router.get('applicationController').dataLoading().done(function (initValue) {
+    App.router.get('userSettingsController').dataLoading('show_bg').done(function (initValue) {
       App.updater.immediateRun('requestMostRecent');
       if(self.get('popupView') && App.HostPopup.get('isBackgroundOperations')){
         self.set ('popupView.isNotShowBgChecked', !initValue);

http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/app/controllers/global/cluster_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/cluster_controller.js b/ambari-web/app/controllers/global/cluster_controller.js
index dbd7a1b..b098c19 100644
--- a/ambari-web/app/controllers/global/cluster_controller.js
+++ b/ambari-web/app/controllers/global/cluster_controller.js
@@ -179,7 +179,7 @@ App.ClusterController = Em.Controller.extend({
       App.router.get('mainController').startPolling();
       return;
     }
-
+    App.router.get('userSettingsController').getAllUserSettings();
     var clusterUrl = this.getUrl('/data/clusters/cluster.json', '?fields=Clusters');
     var hostsController = App.router.get('mainHostController');
     hostsController.set('isCountersUpdating', true);

http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/app/controllers/global/user_settings_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/user_settings_controller.js b/ambari-web/app/controllers/global/user_settings_controller.js
new file mode 100644
index 0000000..e05dfe4
--- /dev/null
+++ b/ambari-web/app/controllers/global/user_settings_controller.js
@@ -0,0 +1,214 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+/**
+ * Controller for user settings
+ * Allows to get them from persist and update them to the persist
+ *
+ * @class UserSettingsController
+ */
+App.UserSettingsController = Em.Controller.extend(App.UserPref, {
+
+  name: 'userSettingsController',
+
+  /**
+   * @type {object}
+   */
+  userSettings: {},
+
+  /**
+   * Each property type is {name: string, defaultValue: *}
+   * @type {object}
+   */
+  userSettingsKeys: function () {
+    var loginName = App.router.get('loginName');
+    var prefix = 'admin-settings-';
+    return {
+      show_bg: {
+        name: prefix +'show-bg-' + loginName,
+        defaultValue: true
+      },
+      timezone: {
+        name: prefix + 'timezone-' + loginName,
+        defaultValue: ''
+      }
+    };
+  }.property('App.router.loginName'),
+
+  /**
+   * Load some user's setting from the persist
+   * If <code>persistKey</code> is not provided, all settings are loaded
+   * @param {string} [persistKey]
+   * @method dataLoading
+   * @returns {$.Deferred.promise}
+   */
+  dataLoading: function (persistKey) {
+    var key = persistKey ? this.get('userSettingsKeys.' + persistKey + '.name') : '';
+    var dfd = $.Deferred();
+    var self = this;
+    this.getUserPref(key).complete(function () {
+      var curPref = self.get('currentPrefObject');
+      self.set('currentPrefObject', null);
+      dfd.resolve(curPref);
+    });
+    return dfd.promise();
+  },
+
+  getUserPrefSuccessCallback: function (response) {
+    if (!Em.isNone(response)) {
+      this.updateUserPrefWithDefaultValues(response);
+    }
+    this.set('currentPrefObject', response);
+    return response;
+  },
+
+  getUserPrefErrorCallback: function (request) {
+    // this user is first time login
+    if (404 == request.status) {
+      this.updateUserPrefWithDefaultValues();
+    }
+  },
+
+  /**
+   * Load all current user's settings to the <code>userSettings</code>
+   * @method getAllUserSettings
+   */
+  getAllUserSettings: function () {
+    var userSettingsKeys = this.get('userSettingsKeys');
+    var userSettings = {};
+    this.dataLoading().done(function (json) {
+      Object.keys(userSettingsKeys).forEach(function (k) {
+        userSettings[k] = JSON.parse(json[userSettingsKeys[k].name]);
+      });
+    });
+    this.set('userSettings', userSettings);
+  },
+
+  /**
+   * If user doesn't have any settings stored in the persist,
+   * default values should be populated there
+   * @param {object} [response]
+   * @method updateUserPrefWithDefaultValues
+   */
+  updateUserPrefWithDefaultValues: function (response) {
+    response = response || {};
+    var keys = this.get('userSettingsKeys');
+    var self = this;
+    Object.keys(keys).forEach(function (key) {
+      if (Em.isNone(response[keys[key].name])) {
+        self.postUserPref(keys[key].name, keys[key].defaultValue);
+      }
+    });
+  },
+
+  /**
+   * "Short"-key method for post user settings to the persist
+   * Example:
+   *  real key is something like 'userSettingsKeys.timezone.name'
+   *  but user should call this method with 'timezone'
+   * @method postUserPref
+   * @param {string} key
+   * @param {*} value
+   * @returns {*}
+   */
+  postUserPref: function (key, value) {
+    return this._super(this.get('userSettingsKeys.' + key + '.name'), value);
+  },
+
+  /**
+   * Sync <code>userSettingsKeys</code> after each POST-update
+   * @returns {*}
+   */
+  postUserPrefSuccessCallback: function () {
+    return this.getAllUserSettings();
+  },
+
+  /**
+   * Open popup with user settings
+   * @method showSettingsPopup
+   */
+  showSettingsPopup: function() {
+    // Settings only for admins
+    if (!App.isAccessible('upgrade_ADMIN')) {
+      return;
+    }
+    var self = this;
+    var curValue = null;
+    var keys = this.get('userSettingsKeys');
+
+    this.dataLoading().done(function (response) {
+      var initValue = JSON.parse(response[keys.show_bg.name]);
+      var initTimezone = JSON.parse(response[keys.timezone.name]);
+
+      return App.ModalPopup.show({
+
+        header: Em.I18n.t('common.userSettings'),
+
+        bodyClass: Em.View.extend({
+
+          templateName: require('templates/common/settings'),
+
+          isNotShowBgChecked: !initValue,
+
+          updateValue: function () {
+            curValue = !this.get('isNotShowBgChecked');
+          }.observes('isNotShowBgChecked'),
+
+          /**
+           * @type {string[]}
+           */
+          timezonesList: [''].concat(moment.tz.names())
+
+        }),
+
+        /**
+         * @type {string}
+         */
+        selectedTimezone: initTimezone,
+
+        primary: Em.I18n.t('common.save'),
+
+        onPrimary: function() {
+          if (Em.isNone(curValue)) {
+            curValue = initValue;
+          }
+          if (!App.get('testMode')) {
+            self.postUserPref('show_bg', curValue);
+            self.postUserPref('timezone', this.get('selectedTimezone'));
+          }
+          if (this.needsPageRefresh()) {
+            location.reload();
+          }
+          this._super();
+        },
+
+        /**
+         * Determines if page should be refreshed after user click "Save"
+         * @returns {boolean}
+         */
+        needsPageRefresh: function () {
+          return initTimezone !== this.get('selectedTimezone');
+        }
+
+      })
+    });
+  }
+
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/app/controllers/installer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/installer.js b/ambari-web/app/controllers/installer.js
index 194d862..811f858 100644
--- a/ambari-web/app/controllers/installer.js
+++ b/ambari-web/app/controllers/installer.js
@@ -704,8 +704,7 @@ App.InstallerController = App.WizardController.extend({
   finish: function () {
     this.setCurrentStep('0');
     this.clearStorageData();
-    var persists = App.router.get('applicationController').persistKey();
-    App.router.get('applicationController').postUserPref(persists, true);
+    App.router.get('userSettingsController').postUserPref('show_bg', true);
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/app/controllers/login_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/login_controller.js b/ambari-web/app/controllers/login_controller.js
index 4f5ccf5..f3e873b 100644
--- a/ambari-web/app/controllers/login_controller.js
+++ b/ambari-web/app/controllers/login_controller.js
@@ -49,6 +49,7 @@ App.LoginController = Em.Object.extend({
       }
       this.set('errorMessage', errorMessage);
     }
+    App.router.get('userSettingsController').dataLoading();
     this.set('isSubmitDisabled', false);
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/app/controllers/main/admin/kerberos.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/kerberos.js b/ambari-web/app/controllers/main/admin/kerberos.js
index 8052704..52ba513 100644
--- a/ambari-web/app/controllers/main/admin/kerberos.js
+++ b/ambari-web/app/controllers/main/admin/kerberos.js
@@ -171,7 +171,7 @@ App.MainAdminKerberosController = App.KerberosWizardStep4Controller.extend({
    */
   regenerateKeytabsSuccess: function (data, opt, params, request) {
     var self = this;
-    App.router.get('applicationController').dataLoading().done(function (initValue) {
+    App.router.get('userSettingsController').dataLoading('show_bg').done(function (initValue) {
       if (initValue) {
         App.router.get('backgroundOperationsController').showPopup();
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/app/controllers/main/host.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host.js b/ambari-web/app/controllers/main/host.js
index 7ffd89e..9a4d600 100644
--- a/ambari-web/app/controllers/main/host.js
+++ b/ambari-web/app/controllers/main/host.js
@@ -990,7 +990,7 @@ App.MainHostController = Em.ArrayController.extend(App.TableServerMixin, {
         secondary: false
       });
     } else {
-      App.router.get('applicationController').dataLoading().done(function (initValue) {
+      App.router.get('userSettingsController').dataLoading('show_bg').done(function (initValue) {
         if (initValue) {
           App.router.get('backgroundOperationsController').showPopup();
         }

http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/app/controllers/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js
index 1560f46..3768dde 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -288,7 +288,7 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
    * @param callback
    */
   showBackgroundOperationsPopup: function (callback) {
-    App.router.get('applicationController').dataLoading().done(function (initValue) {
+    App.router.get('userSettingsController').dataLoading('show_bg').done(function (initValue) {
       if (initValue) {
         App.router.get('backgroundOperationsController').showPopup();
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/app/controllers/main/service.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service.js b/ambari-web/app/controllers/main/service.js
index c589286..266f2ba 100644
--- a/ambari-web/app/controllers/main/service.js
+++ b/ambari-web/app/controllers/main/service.js
@@ -201,7 +201,7 @@ App.MainServiceController = Em.ArrayController.extend({
   silentStopSuccess: function () {
     var self = this;
 
-    App.router.get('applicationController').dataLoading().done(function (initValue) {
+    App.router.get('userSettingsController').dataLoading('show_bg').done(function (initValue) {
       if (initValue) {
         App.router.get('backgroundOperationsController').showPopup();
       }
@@ -241,7 +241,7 @@ App.MainServiceController = Em.ArrayController.extend({
    */
   silentCallSuccessCallback: function () {
     // load data (if we need to show this background operations popup) from persist
-    App.router.get('applicationController').dataLoading().done(function (initValue) {
+    App.router.get('userSettingsController').dataLoading('show_bg').done(function (initValue) {
       if (initValue) {
         App.router.get('backgroundOperationsController').showPopup();
       }
@@ -259,7 +259,7 @@ App.MainServiceController = Em.ArrayController.extend({
     params.query.set('status', 'SUCCESS');
 
     // load data (if we need to show this background operations popup) from persist
-    App.router.get('applicationController').dataLoading().done(function (initValue) {
+    App.router.get('userSettingsController').dataLoading('show_bg').done(function (initValue) {
       if (initValue) {
         App.router.get('backgroundOperationsController').showPopup();
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/app/controllers/main/service/info/summary.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/info/summary.js b/ambari-web/app/controllers/main/service/info/summary.js
index cb5fe4c..04c1992 100644
--- a/ambari-web/app/controllers/main/service/info/summary.js
+++ b/ambari-web/app/controllers/main/service/info/summary.js
@@ -254,7 +254,7 @@ App.MainServiceInfoSummaryController = Em.Controller.extend(App.WidgetSectionMix
   commandSuccessCallback: function () {
     console.log('Send request for refresh configs successfully');
     // load data (if we need to show this background operations popup) from persist
-    App.router.get('applicationController').dataLoading().done(function (showPopup) {
+    App.router.get('userSettingsController').dataLoading('show_bg').done(function (showPopup) {
       if (showPopup) {
         App.router.get('backgroundOperationsController').showPopup();
       }
@@ -279,9 +279,12 @@ App.MainServiceInfoSummaryController = Em.Controller.extend(App.WidgetSectionMix
         controllerBinding: 'App.router.mainAlertDefinitionsController',
         didInsertElement: function () {
           Em.run.next(this, function () {
-            App.tooltip($(".timeago"));
+            App.tooltip(this.$(".timeago"));
           });
         },
+        willDestroyElement:function () {
+          this.$(".timeago").tooltip('destroy');
+        },
         alerts: function () {
           var serviceDefinitions = this.get('controller.content').filterProperty('service', service);
           // definitions should be sorted in order: critical, warning, ok, unknown, other

http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/app/controllers/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/item.js b/ambari-web/app/controllers/main/service/item.js
index 89f44ac..2cd539b 100644
--- a/ambari-web/app/controllers/main/service/item.js
+++ b/ambari-web/app/controllers/main/service/item.js
@@ -133,7 +133,7 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
         }, App.get('testModeDelayForActions'));
       }
       // load data (if we need to show this background operations popup) from persist
-      App.router.get('applicationController').dataLoading().done(function (initValue) {
+      App.router.get('userSettingsController').dataLoading('show_bg').done(function (initValue) {
         if (initValue) {
           App.router.get('backgroundOperationsController').showPopup();
         }
@@ -401,7 +401,7 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
     return App.showConfirmationPopup(function() {
       self.set("content.runRebalancer", true);
       // load data (if we need to show this background operations popup) from persist
-      App.router.get('applicationController').dataLoading().done(function (initValue) {
+      App.router.get('userSettingsController').dataLoading('show_bg').done(function (initValue) {
         if (initValue) {
           App.router.get('backgroundOperationsController').showPopup();
         }
@@ -576,7 +576,7 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
     return App.showConfirmationPopup(function() {
       self.set("content.runCompaction", true);
       // load data (if we need to show this background operations popup) from persist
-      App.router.get('applicationController').dataLoading().done(function (initValue) {
+      App.router.get('userSettingsController').dataLoading('show_bg').done(function (initValue) {
         if (initValue) {
           App.router.get('backgroundOperationsController').showPopup();
         }
@@ -666,7 +666,7 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
   runSmokeTestSuccessCallBack: function (data, ajaxOptions, params) {
     if (data.Requests.id) {
       // load data (if we need to show this background operations popup) from persist
-      App.router.get('applicationController').dataLoading().done(function (initValue) {
+      App.router.get('userSettingsController').dataLoading('show_bg').done(function (initValue) {
         params.query.set('status', 'SUCCESS');
         if (initValue) {
           App.router.get('backgroundOperationsController').showPopup();

http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/app/mappers/alert_definition_summary_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/alert_definition_summary_mapper.js b/ambari-web/app/mappers/alert_definition_summary_mapper.js
index 04cec55..b795638 100644
--- a/ambari-web/app/mappers/alert_definition_summary_mapper.js
+++ b/ambari-web/app/mappers/alert_definition_summary_mapper.js
@@ -51,7 +51,7 @@ App.alertDefinitionSummaryMapper = App.QuickDataMapper.create({
         });
         summaryMap[alertDefinitionSummary.definition_id] = {
           summary: summary,
-          lastTriggered: parseInt(timestamp)
+          lastTriggered: App.dateTimeWithTimeZone(parseInt(timestamp))
         };
       }
     });

http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/app/mappers/alert_instances_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/alert_instances_mapper.js b/ambari-web/app/mappers/alert_instances_mapper.js
index cd1f8bd..45a4760 100644
--- a/ambari-web/app/mappers/alert_instances_mapper.js
+++ b/ambari-web/app/mappers/alert_instances_mapper.js
@@ -58,6 +58,8 @@ App.alertInstanceMapper = App.QuickDataMapper.create({
 
       json.items.forEach(function (item) {
         var alert = this.parseIt(item, this.get('config'));
+        alert.original_timestamp = App.dateTimeWithTimeZone(alert.original_timestamp);
+        alert.latest_timestamp = App.dateTimeWithTimeZone(alert.latest_timestamp);
         alertInstances.push(alert);
         alertsToDelete = alertsToDelete.without(alert.id);
       }, this);

http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/app/mappers/service_config_version_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/service_config_version_mapper.js b/ambari-web/app/mappers/service_config_version_mapper.js
index 23dcdcb..e58a7c3 100644
--- a/ambari-web/app/mappers/service_config_version_mapper.js
+++ b/ambari-web/app/mappers/service_config_version_mapper.js
@@ -53,6 +53,7 @@ App.serviceConfigVersionsMapper = App.QuickDataMapper.create({
         var parsedItem = this.parseIt(item, this.get('config'));
         parsedItem.id = this.makeId(parsedItem.service_name, parsedItem.version);
         parsedItem.is_requested = true;
+        parsedItem.create_time = App.dateTimeWithTimeZone(parsedItem.create_time);
         itemIds[parsedItem.id] = true;
         parsedItem.index = index;
         if (serviceToHostMap[item.service_name]) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 2959bc1..3fe0880 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -38,6 +38,7 @@ Em.I18n.translations = {
   'app.settings':'Settings',
   'app.manageAmbari': 'Manage Ambari',
   'app.aboutAmbari':'About',
+  'app.settings.selectTimezone': 'Select your timezone',
   'app.settings.notshowBgOperationsPopup': 'Do not show the Background Operations dialog when starting an operation',
   'app.settings.notShowBgOperations': 'Do not show this dialog again when starting a background operation',
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/app/mixins/common/userPref.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/userPref.js b/ambari-web/app/mixins/common/userPref.js
index a82e014..c4728bc 100644
--- a/ambari-web/app/mixins/common/userPref.js
+++ b/ambari-web/app/mixins/common/userPref.js
@@ -26,8 +26,8 @@ var App = require('app');
  * <ul>
  *   <li>getUserPrefSuccessCallback</li>
  *   <li>getUserPrefErrorCallback</li>
- *   <li>postuserPrefSuccessCallback</li>
- *   <li>postuserPrefErrorCallback</li>
+ *   <li>postUserPrefSuccessCallback</li>
+ *   <li>postUserPrefErrorCallback</li>
  * </ul>
  * @type {Em.Mixin}
  */

http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/app/templates/application.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/application.hbs b/ambari-web/app/templates/application.hbs
index 586a0b7..0a8309a 100644
--- a/ambari-web/app/templates/application.hbs
+++ b/ambari-web/app/templates/application.hbs
@@ -80,7 +80,7 @@
                 {{/if}}
                 {{#if isClusterDataLoaded}}
                   {{#isAccessible upgrade_ADMIN}}
-                    <li><a href="" {{action showSettingsPopup target="controller"}}>{{t app.settings}}</a></li>
+                    <li><a href="" {{action showSettingsPopup target="App.router.userSettingsController"}}>{{t app.settings}}</a></li>
                   {{/isAccessible}}
                 {{/if}}
                 {{#if showExitLink}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/app/templates/common/settings.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/settings.hbs b/ambari-web/app/templates/common/settings.hbs
index dfbcab0..cd1dd44 100644
--- a/ambari-web/app/templates/common/settings.hbs
+++ b/ambari-web/app/templates/common/settings.hbs
@@ -23,4 +23,14 @@
       {{t app.settings.notshowBgOperationsPopup}}
     </label>
   </div>
+  <div>
+    <label>
+      {{t app.settings.selectTimezone}}
+      {{view Em.Select
+        contentBinding="view.timezonesList"
+        selectionBinding="view.parentView.selectedTimezone"
+        class="group-select select-group-box"
+      }}
+    </label>
+  </div>
 </div>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/app/utils/batch_scheduled_requests.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/batch_scheduled_requests.js b/ambari-web/app/utils/batch_scheduled_requests.js
index 95d8f9b..3e57a3b 100644
--- a/ambari-web/app/utils/batch_scheduled_requests.js
+++ b/ambari-web/app/utils/batch_scheduled_requests.js
@@ -22,7 +22,7 @@ var App = require('app');
  * @type {Function}
  */
 var defaultSuccessCallback = function(data, ajaxOptions, params) {
-  App.router.get('applicationController').dataLoading().done(function(initValue) {
+  App.router.get('userSettingsController').dataLoading('show_bg').done(function(initValue) {
     params.query && params.query.set('status', 'SUCCESS');
     if (initValue) {
       App.router.get('backgroundOperationsController').showPopup();

http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/app/utils/date.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/date.js b/ambari-web/app/utils/date.js
index 73555b4..f6d98f5 100644
--- a/ambari-web/app/utils/date.js
+++ b/ambari-web/app/utils/date.js
@@ -41,8 +41,7 @@ module.exports = {
    * @method dateFormatZeroFirst
    */
   dateFormatZeroFirst: function (time) {
-    if (time < 10) return '0' + time;
-    return ""  + time;
+    return (time < 10 ? '0' : '') + time;
   },
 
   /**
@@ -127,7 +126,6 @@ module.exports = {
     var durationSummary = '';
     var startDate = new Date(startTimestamp);
     var endDate = new Date(endTimestamp);
-    var self = this;
     if (startDate.getFullYear() == 1969 || startTimestamp < 1) {
       // not started
       return Em.I18n.t('common.na');
@@ -176,19 +174,21 @@ module.exports = {
 
     if (lengthOfNumber < 4) {
       return time + ' ms';
-    } else if (lengthOfNumber < 7) {
+    }
+    if (lengthOfNumber < 7) {
       time = (time / 1000).toFixed(2);
       return time + ' secs';
-    } else if (time < oneHourMs) {
+    }
+    if (time < oneHourMs) {
       time = (time / oneMinMs).toFixed(2);
       return time + ' mins';
-    } else if (time < oneDayMs) {
+    }
+    if (time < oneDayMs) {
       time = (time / oneHourMs).toFixed(2);
       return time + ' hours';
-    } else {
-      time = (time / oneDayMs).toFixed(2);
-      return time + ' days';
     }
+    time = (time / oneDayMs).toFixed(2);
+    return time + ' days';
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/app/utils/helper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/helper.js b/ambari-web/app/utils/helper.js
index 7ced41d..5ccc0a2 100644
--- a/ambari-web/app/utils/helper.js
+++ b/ambari-web/app/utils/helper.js
@@ -621,6 +621,19 @@ App.dateTime = function() {
 };
 
 /**
+ *
+ * @param {number} [x] timestamp
+ * @returns {number}
+ */
+App.dateTimeWithTimeZone = function (x) {
+  var timezone = App.router.get('userSettingsController.userSettings.timezone');
+  if (timezone) {
+    return moment(moment.tz(x ? new Date(x) : new Date(), timezone).toArray()).toDate().getTime();
+  }
+  return x || new Date().getTime();
+};
+
+/**
  * Helper function for bound property helper registration
  * @memberof App
  * @method registerBoundHelper

http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/app/utils/host_progress_popup.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/host_progress_popup.js b/ambari-web/app/utils/host_progress_popup.js
index 6c75340..7e83389 100644
--- a/ambari-web/app/utils/host_progress_popup.js
+++ b/ambari-web/app/utils/host_progress_popup.js
@@ -692,9 +692,8 @@ App.HostPopup = Em.Object.create({
        */
       updateNotShowBgChecked: function () {
         var curVal = !this.get('isNotShowBgChecked');
-        var key = App.router.get('applicationController').persistKey();
         if (!App.get('testMode')) {
-          App.router.get('applicationController').postUserPref(key, curVal);
+          App.router.get('userSettingsController').postUserPref('show_bg', curVal);
         }
       }.observes('isNotShowBgChecked'),
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/app/views/common/chart/linear_time.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/chart/linear_time.js b/ambari-web/app/views/common/chart/linear_time.js
index 4deb84d..97e3d7d 100644
--- a/ambari-web/app/views/common/chart/linear_time.js
+++ b/ambari-web/app/views/common/chart/linear_time.js
@@ -5,9 +5,9 @@
  * licenses this file to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -17,17 +17,18 @@
 
 var App = require('app');
 var string_utils = require('utils/string_utils');
+var dateUtils = require('utils/date');
 
 /**
  * @class
- * 
+ *
  * This is a view which GETs data from a URL and shows it as a time based line
  * graph. Time is shown on the X axis with data series shown on Y axis. It
  * optionally also has the ability to auto refresh itself over a given time
  * interval.
- * 
+ *
  * This is an abstract class which is meant to be extended.
- * 
+ *
  * Extending classes should override the following:
  * <ul>
  * <li>url - from where the data can be retrieved
@@ -36,12 +37,12 @@ var string_utils = require('utils/string_utils');
  * <li>#transformToSeries(jsonData) - function to map server data into graph
  * series
  * </ul>
- * 
+ *
  * Extending classes could optionally override the following:
  * <ul>
  * <li>#colorForSeries(series) - function to get custom colors per series
  * </ul>
- * 
+ *
  * @extends Ember.Object
  * @extends Ember.View
  */
@@ -151,13 +152,13 @@ App.ChartLinearTimeView = Ember.View.extend({
    */
   displayUnit: null,
 
-  _containerSelector: function() {
-    return ['#', this.get('id'), '-container'].join('');
+  _containerSelector: function () {
+    return '#' + this.get('id') + '-container';
   }.property('id'),
 
-  _popupSelector: function() {
-    return [this.get('_containerSelector'), this.get('popupSuffix')].join('');
-  }.property('_containerSelector'),
+  _popupSelector: function () {
+    return this.get('_containerSelector') + this.get('popupSuffix');
+  }.property('_containerSelector', 'popupSuffix'),
 
   didInsertElement: function () {
     this.loadData();
@@ -174,7 +175,7 @@ App.ChartLinearTimeView = Ember.View.extend({
     $(this.get('_popupSelector') + ' li.line').off();
   },
 
-  registerGraph: function() {
+  registerGraph: function () {
     var graph = {
       name: this.get('title'),
       id: this.get('elementId'),
@@ -183,11 +184,11 @@ App.ChartLinearTimeView = Ember.View.extend({
     App.router.get('updateController.graphs').push(graph);
   },
 
-  loadData: function() {
+  loadData: function () {
     if (this.get('loadGroup') && !this.get('isPopup')) {
-      App.ChartLinearTimeView.LoadAggregator.add(this, this.get('loadGroup'));
+      return App.ChartLinearTimeView.LoadAggregator.add(this, this.get('loadGroup'));
     } else {
-      App.ajax.send({
+      return App.ajax.send({
         name: this.get('ajaxIndex'),
         sender: this,
         data: this.getDataForAjaxRequest(),
@@ -197,7 +198,7 @@ App.ChartLinearTimeView = Ember.View.extend({
     }
   },
 
-  getDataForAjaxRequest: function() {
+  getDataForAjaxRequest: function () {
     var toSeconds = Math.round(App.dateTime() / 1000);
     var hostName = (this.get('content')) ? this.get('content.hostName') : "";
 
@@ -219,7 +220,7 @@ App.ChartLinearTimeView = Ember.View.extend({
     };
   },
 
-  loadDataErrorCallback: function(xhr, textStatus, errorThrown) {
+  loadDataErrorCallback: function (xhr, textStatus, errorThrown) {
     this.set('isReady', true);
     if (xhr.readyState == 4 && xhr.status) {
       textStatus = xhr.status + " " + textStatus;
@@ -237,22 +238,17 @@ App.ChartLinearTimeView = Ember.View.extend({
    * @param tooltip Tooltip content
    * @type: Function
    */
-  _showMessage: function(type, title, message, tooltip) {
+  _showMessage: function (type, title, message, tooltip) {
+    var popupSuffix = this.get('isPopup') ? this.get('popupSuffix') : '';
     var chartOverlay = '#' + this.get('id');
-    var chartOverlayId = chartOverlay + '-chart';
-    var chartOverlayY = chartOverlay + '-yaxis';
-    var chartOverlayX = chartOverlay + '-xaxis';
-    var chartOverlayLegend = chartOverlay + '-legend';
-    var chartOverlayTimeline = chartOverlay + '-timeline';
+    var chartOverlayId = chartOverlay + '-chart' + popupSuffix;
+    var chartOverlayY = chartOverlay + '-yaxis' + popupSuffix;
+    var chartOverlayX = chartOverlay + '-xaxis' + popupSuffix;
+    var chartOverlayLegend = chartOverlay + '-legend' + popupSuffix;
+    var chartOverlayTimeline = chartOverlay + '-timeline' + popupSuffix;
     var tooltipTitle = tooltip ? tooltip : Em.I18n.t('graphs.tooltip.title');
     var chartContent = '';
-    if (this.get('isPopup')) {
-      chartOverlayId += this.get('popupSuffix');
-      chartOverlayY += this.get('popupSuffix');
-      chartOverlayX += this.get('popupSuffix');
-      chartOverlayLegend += this.get('popupSuffix');
-      chartOverlayTimeline += this.get('popupSuffix');
-    }
+
     var typeClass;
     switch (type) {
       case 'error':
@@ -268,7 +264,7 @@ App.ChartLinearTimeView = Ember.View.extend({
         typeClass = '';
         break;
     }
-    $(chartOverlayId+', '+chartOverlayY+', '+chartOverlayX+', '+chartOverlayLegend+', '+chartOverlayTimeline).html('');
+    $(chartOverlayId + ', ' + chartOverlayY + ', ' + chartOverlayX + ', ' + chartOverlayLegend + ', ' + chartOverlayTimeline).html('');
     chartContent += '<div class=\"alert ' + typeClass + '\">';
     if (title) {
       chartContent += '<strong>' + title + '</strong> ';
@@ -295,8 +291,7 @@ App.ChartLinearTimeView = Ember.View.extend({
    *
    */
   transformData: function (seriesData, displayName) {
-    var seriesArray = [];
-    if (seriesData != null) {
+    if (!Em.isNone(seriesData)) {
       // Is it a string?
       if ("string" == typeof seriesData) {
         seriesData = JSON.parse(seriesData);
@@ -306,16 +301,17 @@ App.ChartLinearTimeView = Ember.View.extend({
         // Same number applies to all time.
         var number = seriesData;
         seriesData = [];
-        seriesData.push([number, App.dateTime()-(60*60)]);
+        seriesData.push([number, App.dateTime() - (60 * 60)]);
         seriesData.push([number, App.dateTime()]);
       }
       // We have valid data
       var series = {};
       series.name = displayName;
       series.data = [];
-      for ( var index = 0; index < seriesData.length; index++) {
+      for (var index = 0; index < seriesData.length; index++) {
+        var x = App.dateTimeWithTimeZone(seriesData[index][1] * 1000) / 1000;
         series.data.push({
-          x: seriesData[index][1],
+          x: x,
           y: seriesData[index][0]
         });
       }
@@ -332,7 +328,7 @@ App.ChartLinearTimeView = Ember.View.extend({
    *
    * @type Function
    */
-  yAxisFormatter: function(y) {
+  yAxisFormatter: function (y) {
     return App.ChartLinearTimeView.DefaultFormatter(y);
   },
 
@@ -353,17 +349,17 @@ App.ChartLinearTimeView = Ember.View.extend({
   },
 
   /**
-  * Check whether seriesData is correct data for chart drawing
-  * @param {Array} seriesData
-  * @return {Boolean}
-  */
-  checkSeries : function(seriesData) {
-    if(!seriesData || !seriesData.length) {
+   * Check whether seriesData is correct data for chart drawing
+   * @param {Array} seriesData
+   * @return {Boolean}
+   */
+  checkSeries: function (seriesData) {
+    if (!seriesData || !seriesData.length) {
       return false;
     }
     var result = true;
-    seriesData.forEach(function(item) {
-      if(!item.data || !item.data.length || !item.data[0] || typeof item.data[0].x === 'undefined') {
+    seriesData.forEach(function (item) {
+      if (Em.isNone(Em.get(item, 'data.0.x'))) {
         result = false;
       }
     });
@@ -378,7 +374,7 @@ App.ChartLinearTimeView = Ember.View.extend({
    * @type Function
    */
   _refreshGraph: function (jsonData) {
-    if(this.get('isDestroyed')){
+    if (this.get('isDestroyed')) {
       return;
     }
     var seriesData = this.transformToSeries(jsonData);
@@ -387,7 +383,7 @@ App.ChartLinearTimeView = Ember.View.extend({
     var popup_path = $(this.get('_popupSelector'));
     var graph_container = $(this.get('_containerSelector'));
     var container;
-    if(popup_path.length) {
+    if (popup_path.length) {
       popup_path.children().each(function () {
         $(this).children().remove();
       });
@@ -404,7 +400,7 @@ App.ChartLinearTimeView = Ember.View.extend({
         container = $(this.get('_containerSelector'));
         this.draw(seriesData);
         this.set('hasData', true);
-          //move yAxis value lower to make them fully visible
+        //move yAxis value lower to make them fully visible
         container.find('.y_axis text').attr('y', 8);
         container.attr('data-original-title', Em.I18n.t('graphs.tooltip.title'));
       }
@@ -412,7 +408,7 @@ App.ChartLinearTimeView = Ember.View.extend({
     else {
       this.set('isReady', true);
       //if Axis X time interval is default(60 minutes)
-      if(this.get('timeUnitSeconds') === 3600){
+      if (this.get('timeUnitSeconds') === 3600) {
         this._showMessage('info', null, this.t('graphs.noData.message'), this.t('graphs.noData.tooltip.title'));
         this.set('hasData', false);
       }
@@ -435,9 +431,9 @@ App.ChartLinearTimeView = Ember.View.extend({
    * @type Function
    * @return Rickshaw.Fixtures.Time
    */
-  localeTimeUnit: function(timeUnitSeconds) {
+  localeTimeUnit: function (timeUnitSeconds) {
     var timeUnit = new Rickshaw.Fixtures.Time();
-    switch (timeUnitSeconds){
+    switch (timeUnitSeconds) {
       case 604800:
         timeUnit = timeUnit.unit('day');
         break;
@@ -453,8 +449,8 @@ App.ChartLinearTimeView = Ember.View.extend({
           seconds: timeUnitSeconds / 4,
           formatter: function (d) {
             // format locale specific time
-            var minutes = d.getMinutes() > 9 ? "" + d.getMinutes() : "0" + d.getMinutes();
-            var hours = d.getHours() > 9 ? "" + d.getHours() : "0" + d.getHours();
+            var minutes = dateUtils.dateFormatZeroFirst(d.getMinutes());
+            var hours = dateUtils.dateFormatZeroFirst(d.getHours());
             return hours + ":" + minutes;
           }
         };
@@ -463,34 +459,12 @@ App.ChartLinearTimeView = Ember.View.extend({
   },
 
   /**
-   * temporary fix for incoming data for graph
-   * to shift data time to correct time point
-   * @param {Array} data
-   */
-  dataShiftFix: function(data) {
-    var nowTime = Math.round(App.dateTime() / 1000);
-    data.forEach(function(series){
-      var l = series.data.length;
-      var shiftDiff = nowTime - series.data[l - 1].x;
-      if(shiftDiff > 3600){
-        for(var i = 0;i < l;i++){
-          series.data[i].x = series.data[i].x + shiftDiff;
-        }
-        series.data.unshift({
-          x: nowTime - this.get('timeUnitSeconds'),
-          y: 0
-        });
-      }
-    }, this);
-  },
-
-  /**
    * calculate statistic data for popup legend and set proper colors for series
    * @param {Array} data
    */
-  dataPreProcess: function(data) {
+  dataPreProcess: function (data) {
     var self = this;
-    var palette = new Rickshaw.Color.Palette({ scheme: 'munin'});
+    var palette = new Rickshaw.Color.Palette({scheme: 'munin'});
     // Format series for display
     var series_min_length = 100000000;
     data.forEach(function (series) {
@@ -520,12 +494,12 @@ App.ChartLinearTimeView = Ember.View.extend({
 
 
         series.name = string_utils.pad(series.name.length > 36 ? series.name.substr(0, 36) + '...' : series.name, 40, '&nbsp;', 2) + '|&nbsp;' +
-        string_utils.pad('min', 5, '&nbsp;', 3) +
-        string_utils.pad(self.get('yAxisFormatter')(min), 12, '&nbsp;', 3) +
-        string_utils.pad('avg', 5, '&nbsp;', 3) +
-        string_utils.pad(self.get('yAxisFormatter')(avg / series.data.compact().length), 12, '&nbsp;', 3) +
-        string_utils.pad('max', 12, '&nbsp;', 3) +
-        string_utils.pad(self.get('yAxisFormatter')(max), 5, '&nbsp;', 3);
+          string_utils.pad('min', 5, '&nbsp;', 3) +
+          string_utils.pad(self.get('yAxisFormatter')(min), 12, '&nbsp;', 3) +
+          string_utils.pad('avg', 5, '&nbsp;', 3) +
+          string_utils.pad(self.get('yAxisFormatter')(avg / series.data.compact().length), 12, '&nbsp;', 3) +
+          string_utils.pad('max', 12, '&nbsp;', 3) +
+          string_utils.pad(self.get('yAxisFormatter')(max), 5, '&nbsp;', 3);
       }
       if (series.data.length < series_min_length) {
         series_min_length = series.data.length;
@@ -533,69 +507,40 @@ App.ChartLinearTimeView = Ember.View.extend({
     });
 
     // All series should have equal length
-    data.forEach(function(series) {
+    data.forEach(function (series) {
       if (series.data.length > series_min_length) {
         series.data.length = series_min_length;
       }
     });
   },
 
-  draw: function(seriesData) {
+  draw: function (seriesData) {
     var self = this;
     var isPopup = this.get('isPopup');
     var p = isPopup ? this.get('popupSuffix') : '';
 
-    this.dataShiftFix(seriesData);
     this.dataPreProcess(seriesData);
 
-    var chartId = "#" + this.get('id') + "-chart" + p;
-    var chartOverlayId = "#" + this.get('id') + "-container" + p;
-    var xaxisElementId = "#" + this.get('id') + "-xaxis" + p;
-    var yaxisElementId = "#" + this.get('id') + "-yaxis" + p;
-    var legendElementId = "#" + this.get('id') + "-legend" + p;
+    var chartElement = document.querySelector("#" + this.get('id') + "-chart" + p);
+    var overlayElement = document.querySelector(+this.get('id') + "-container" + p);
+    var xaxisElement = document.querySelector("#" + this.get('id') + "-xaxis" + p);
+    var yaxisElement = document.querySelector("#" + this.get('id') + "-yaxis" + p);
+    var legendElement = document.querySelector("#" + this.get('id') + "-legend" + p);
 
-    var chartElement = document.querySelector(chartId);
-    var overlayElement = document.querySelector(chartOverlayId);
-    var xaxisElement = document.querySelector(xaxisElementId);
-    var yaxisElement = document.querySelector(yaxisElementId);
-    var legendElement = document.querySelector(legendElementId);
-
-    var height = this.get('height');
-    var width = 400;
-    var diff = 32;
-
-    if(this.get('inWidget')) {
-      height = 105; // for widgets view
-      diff = 22;
-    }
-    if (isPopup) {
-      height = 180;
-      width = 670;
-    }
-    else {
-      // If not in popup, the width could vary.
-      // We determine width based on div's size.
-      var thisElement = this.get('element');
-      if (thisElement!=null) {
-        var calculatedWidth = $(thisElement).width();
-        if (calculatedWidth > diff) {
-          width = calculatedWidth - diff;
-        }
-      }
-    }
+    var graphSize = this._calculateGraphSize();
 
     var _graph = new Rickshaw.GraphReopened({
-      height: height,
-      width: width,
+      height: graphSize.height,
+      width: graphSize.width,
       element: chartElement,
       series: seriesData,
       interpolation: 'step-after',
       stroke: true,
       renderer: this.get('renderer'),
-      strokeWidth: (this.get('renderer') != 'area' ? 2 : 1)
+      strokeWidth: 'area' === this.get('renderer') ? 1 : 2
     });
 
-    if (this.get('renderer') === 'area') {
+    if ('area' === this.get('renderer')) {
       _graph.renderer.unstack = false;
     }
 
@@ -606,9 +551,9 @@ App.ChartLinearTimeView = Ember.View.extend({
 
     new Rickshaw.Graph.Axis.Y({
       tickFormat: this.yAxisFormatter,
-      pixelsPerTick: (isPopup ? 75 : 40),
+      pixelsPerTick: isPopup ? 75 : 40,
       element: yaxisElement,
-      orientation: (isPopup ? 'left' : 'right'),
+      orientation: isPopup ? 'left' : 'right',
       graph: _graph
     });
 
@@ -642,12 +587,12 @@ App.ChartLinearTimeView = Ember.View.extend({
       });
     }
 
-    this.$().on('remove', function() {
+    this.$().on('remove', function () {
       $(overlayElement).off();
     });
 
     //show the graph when it's loaded
-    _graph.onUpdate(function() {
+    _graph.onUpdate(function () {
       self.set('isReady', true);
     });
     _graph.render();
@@ -655,13 +600,13 @@ App.ChartLinearTimeView = Ember.View.extend({
     if (isPopup) {
       new Rickshaw.Graph.HoverDetail({
         graph: _graph,
-        yFormatter:function (y) {
+        yFormatter: function (y) {
           return self.yAxisFormatter(y);
         },
-        xFormatter:function (x) {
+        xFormatter: function (x) {
           return (new Date(x * 1000)).toLocaleTimeString();
         },
-        formatter:function (series, x, y, formattedX, formattedY, d) {
+        formatter: function (series, x, y, formattedX, formattedY) {
           return formattedY + '<br />' + formattedX;
         }
       });
@@ -670,14 +615,15 @@ App.ChartLinearTimeView = Ember.View.extend({
     _graph = this.updateSeriesInGraph(_graph);
     if (isPopup) {
       //show the graph when it's loaded
-      _graph.onUpdate(function() {
+      _graph.onUpdate(function () {
         self.set('isPopupReady', true);
       });
       _graph.update();
 
-      $(this.get('_popupSelector') + ' li.line').click(function() {
+      var popupSelector = this.get('_popupSelector');
+      $(popupSelector + ' li.line').click(function () {
         var series = [];
-        $(this.get('_popupSelector') + ' a.action').each(function(index, v) {
+        $(popupSelector + ' a.action').each(function (index, v) {
           series[index] = v.parentNode.classList;
         });
         self.set('_seriesProperties', series);
@@ -687,9 +633,10 @@ App.ChartLinearTimeView = Ember.View.extend({
     }
     else {
       _graph.update();
-      $(this.get('_containerSelector') + ' li.line').click(function() {
+      var containerSelector = this.get('_containerSelector');
+      $(containerSelector + ' li.line').click(function () {
         var series = [];
-        $(this.get('_containerSelector') + ' a.action').each(function(index, v) {
+        $(containerSelector + ' a.action').each(function (index, v) {
           series[index] = v.parentNode.classList;
         });
         self.set('_seriesPropertiesWidget', series);
@@ -700,18 +647,54 @@ App.ChartLinearTimeView = Ember.View.extend({
   },
 
   /**
+   * Calculate graph size
+   * @returns {{width: number, height: number}}
+   * @private
+   */
+  _calculateGraphSize: function () {
+    var isPopup = this.get('isPopup');
+    var height = this.get('height');
+    var width = 400;
+    var diff = 32;
+
+    if (this.get('inWidget')) {
+      height = 105; // for widgets view
+      diff = 22;
+    }
+    if (isPopup) {
+      height = 180;
+      width = 670;
+    }
+    else {
+      // If not in popup, the width could vary.
+      // We determine width based on div's size.
+      var thisElement = this.get('element');
+      if (!Em.isNone(thisElement)) {
+        var calculatedWidth = $(thisElement).width();
+        if (calculatedWidth > diff) {
+          width = calculatedWidth - diff;
+        }
+      }
+    }
+    return {
+      width: width,
+      height: height
+    }
+  },
+
+  /**
    *
    * @param {Rickshaw.Graph} graph
    * @returns {Rickshaw.Graph}
    */
-  updateSeriesInGraph: function(graph) {
+  updateSeriesInGraph: function (graph) {
     var id = this.get('id');
     var isPopup = this.get('isPopup');
     var popupSuffix = this.get('popupSuffix');
     var _series = isPopup ? this.get('_seriesProperties') : this.get('_seriesPropertiesWidget');
-    graph.series.forEach(function(series, index) {
-      if (_series !== null && _series[index] !== null && _series[index] !== undefined ) {
-        if(_series[_series.length - index - 1].length > 1) {
+    graph.series.forEach(function (series, index) {
+      if (_series && !Em.isNone(_series[index])) {
+        if (_series[_series.length - index - 1].length > 1) {
           var s = '#' + id + '-container' + (isPopup ? popupSuffix : '') + ' a.action:eq(' + (_series.length - index - 1) + ')';
           $(s).parent('li').addClass('disabled');
           series.disable();
@@ -721,8 +704,8 @@ App.ChartLinearTimeView = Ember.View.extend({
     return graph;
   },
 
-  showGraphInPopup: function() {
-    if(!this.get('hasData') || this.get('isPreview')) {
+  showGraphInPopup: function () {
+    if (!this.get('hasData') || this.get('isPreview')) {
       return;
     }
 
@@ -745,11 +728,11 @@ App.ChartLinearTimeView = Ember.View.extend({
         titleId: null,
         titleClass: null,
 
-        isReady: function() {
+        isReady: function () {
           return this.get('parentView.graph.isPopupReady');
         }.property('parentView.graph.isPopupReady'),
 
-        didInsertElement: function() {
+        didInsertElement: function () {
           $('#modal').addClass('modal-graph-line');
           var popupSuffix = this.get('parentView.graph.popupSuffix');
           var id = this.get('parentView.graph.id');
@@ -773,38 +756,46 @@ App.ChartLinearTimeView = Ember.View.extend({
         /**
          * check is time paging feature is enable for graph
          */
-        isTimePagingEnable: function() {
+        isTimePagingEnable: function () {
           return !self.get('isTimePagingDisable');
         }.property(),
-        rightArrowVisible: function() {
+
+        rightArrowVisible: function () {
           return (this.get('isReady') && (this.get('parentView.currentTimeIndex') != 0));
         }.property('isReady', 'parentView.currentTimeIndex'),
-        leftArrowVisible: function() {
+
+        leftArrowVisible: function () {
           return (this.get('isReady') && (this.get('parentView.currentTimeIndex') != 7));
         }.property('isReady', 'parentView.currentTimeIndex')
+
       }),
       header: this.get('title'),
       /**
        * App.ChartLinearTimeView
        */
       graph: self,
+
       secondary: null,
-      onPrimary: function() {
-        self.set('currentTimeIndex', 0);
-        this.hide();
-        self.set('isPopup', false);
+
+      onPrimary: function () {
+        self.setProperties({
+          currentTimeIndex: 0,
+          isPopup: false
+        });
+        this._super();
       },
-      onClose: function() {
+
+      onClose: function () {
         this.onPrimary();
       },
       /**
        * move graph back by time
        * @param event
        */
-      switchTimeBack: function(event) {
+      switchTimeBack: function (event) {
         var index = this.get('currentTimeIndex');
         // 7 - number of last time state
-        if(index < 7) {
+        if (index < 7) {
           this.reloadGraphByTime(++index);
         }
       },
@@ -812,9 +803,9 @@ App.ChartLinearTimeView = Ember.View.extend({
        * move graph forward by time
        * @param event
        */
-      switchTimeForward: function(event) {
+      switchTimeForward: function (event) {
         var index = this.get('currentTimeIndex');
-        if(index > 0) {
+        if (index) {
           this.reloadGraphByTime(--index);
         }
       },
@@ -822,16 +813,18 @@ App.ChartLinearTimeView = Ember.View.extend({
        * reload graph depending on the time
        * @param index
        */
-      reloadGraphByTime: function(index) {
+      reloadGraphByTime: function (index) {
         this.set('currentTimeIndex', index);
         self.set('currentTimeIndex', index);
       },
       currentTimeIndex: self.get('currentTimeIndex'),
-      currentTimeState: function() {
+
+      currentTimeState: function () {
         return self.get('timeStates').objectAt(this.get('currentTimeIndex'));
       }.property('currentTimeIndex')
+
     });
-    Ember.run.next(function() {
+    Em.run.next(function () {
       self.loadData();
       self.set('isPopupReady', false);
     });
@@ -839,6 +832,7 @@ App.ChartLinearTimeView = Ember.View.extend({
   reloadGraphByTime: function () {
     this.loadData();
   }.observes('timeUnitSeconds'),
+
   timeStates: [
     {name: Em.I18n.t('graphs.timeRange.hour'), seconds: 3600},
     {name: Em.I18n.t('graphs.timeRange.twoHours'), seconds: 7200},
@@ -851,7 +845,7 @@ App.ChartLinearTimeView = Ember.View.extend({
   ],
   // should be set by time range control dropdown list when create current graph
   currentTimeIndex: 0,
-  timeUnitSeconds: function() {
+  timeUnitSeconds: function () {
     return this.get('timeStates').objectAt(this.get('currentTimeIndex')).seconds;
   }.property('currentTimeIndex')
 });
@@ -859,146 +853,141 @@ App.ChartLinearTimeView = Ember.View.extend({
 /**
  * A formatter which will turn a number into computer storage sizes of the
  * format '23 GB' etc.
- * 
+ *
  * @type {Function}
+ * @return {string}
  */
 App.ChartLinearTimeView.BytesFormatter = function (y) {
-  if (y == 0) return '0 B';
+  if (0 == y) {
+    return '0 B';
+  }
   var value = Rickshaw.Fixtures.Number.formatBase1024KMGTP(y);
-  if (!y || y.length < 1) {
-    value = '0 B';
+  if (!y) {
+    return '0 B';
   }
-  else {
-    if ("number" == typeof value) {
-      value = String(value);
-    }
-    if ("string" == typeof value) {
-      value = value.replace(/\.\d(\d+)/, function($0, $1){ // Remove only 1-digit after decimal part
-        return $0.replace($1, '');
-      }); 
-      // Either it ends with digit or ends with character
-      value = value.replace(/(\d$)/, '$1 '); // Ends with digit like '120'
-      value = value.replace(/([a-zA-Z]$)/, ' $1'); // Ends with character like
-      // '120M'
-      value = value + 'B'; // Append B to make B, MB, GB etc.
-    }
+  if ("number" == typeof value) {
+    value = String(value);
+  }
+  if ("string" == typeof value) {
+    value = value.replace(/\.\d(\d+)/, function ($0, $1) { // Remove only 1-digit after decimal part
+      return $0.replace($1, '');
+    });
+    // Either it ends with digit or ends with character
+    value = value.replace(/(\d$)/, '$1 '); // Ends with digit like '120'
+    value = value.replace(/([a-zA-Z]$)/, ' $1'); // Ends with character like
+    // '120M'
+    value = value + 'B'; // Append B to make B, MB, GB etc.
   }
   return value;
 };
 
 /**
  * A formatter which will turn a number into percentage display like '42%'
- * 
+ *
  * @type {Function}
+ * @param {number} percentage
+ * @return {string}
  */
 App.ChartLinearTimeView.PercentageFormatter = function (percentage) {
-  var value = percentage;
-  if (!value || value.length < 1) {
-    value = '0 %';
-  } else {
-    value = value.toFixed(3).replace(/0+$/, '').replace(/\.$/, '') + '%';
-  }
-  return value;
+  return percentage ?
+    percentage.toFixed(3).replace(/0+$/, '').replace(/\.$/, '') + '%' :
+    '0 %';
 };
 
 /**
  * A formatter which will turn a number into percentage display like '42%'
  *
  * @type {Function}
+ * @param {number} value
+ * @param {string} displayUnit
+ * @return {string}
  */
 App.ChartLinearTimeView.DisplayUnitFormatter = function (value, displayUnit) {
-  if (!value || value.length === 0) {
-    value = '0 ' + displayUnit;
-  } else {
-    value = value.toFixed(3).replace(/0+$/, '').replace(/\.$/, '') + " " + displayUnit;
-  }
-  return value;
+  return value ?
+    value.toFixed(3).replace(/0+$/, '').replace(/\.$/, '') + " " + displayUnit :
+    '0 ' + displayUnit;
 };
 
 /**
  * A formatter which will turn elapsed time into display time like '50 ms',
  * '5s', '10 m', '3 hr' etc. Time is expected to be provided in milliseconds.
- * 
+ *
  * @type {Function}
+ * @return {string}
  */
 App.ChartLinearTimeView.TimeElapsedFormatter = function (millis) {
-  var value = millis;
-  if (!value || value.length < 1) {
-    value = '0 ms';
-  } else if ("number" == typeof millis) {
+  if (!millis) {
+    return '0 ms';
+  }
+  if ('number' == Em.typeOf(millis)) {
     var seconds = millis > 1000 ? Math.round(millis / 1000) : 0;
     var minutes = seconds > 60 ? Math.round(seconds / 60) : 0;
     var hours = minutes > 60 ? Math.round(minutes / 60) : 0;
     var days = hours > 24 ? Math.round(hours / 24) : 0;
     if (days > 0) {
-      value = days + ' d';
-    } else if (hours > 0) {
-      value = hours + ' hr';
-    } else if (minutes > 0) {
-      value = minutes + ' m';
-    } else if (seconds > 0) {
-      value = seconds + ' s';
-    } else if (millis > 0) {
-      value = millis.toFixed(3).replace(/0+$/, '').replace(/\.$/, '') + ' ms';
-    } else {
-      value = millis.toFixed(3).replace(/0+$/, '').replace(/\.$/, '') + ' ms';
+      return days + ' d';
+    }
+    if (hours > 0) {
+      return hours + ' hr';
+    }
+    if (minutes > 0) {
+      return minutes + ' m';
     }
+    if (seconds > 0) {
+      return seconds + ' s';
+    }
+    return millis.toFixed(3).replace(/0+$/, '').replace(/\.$/, '') + ' ms';
   }
-  return value;
+  return millis;
 };
 
 /**
- * The default formatter which uses Rickshaw.Fixtures.Number.formatKMBT 
+ * The default formatter which uses Rickshaw.Fixtures.Number.formatKMBT
  * which shows 10K, 300M etc.
  *
  * @type {Function}
+ * @return {string|number}
  */
-App.ChartLinearTimeView.DefaultFormatter = function(y) {
-  if(isNaN(y)){
+App.ChartLinearTimeView.DefaultFormatter = function (y) {
+  if (!y) {
     return 0;
   }
   var value = Rickshaw.Fixtures.Number.formatKMBT(y);
-  if (value == '') return '0';
+  if ('' == value) return '0';
   value = String(value);
   var c = value[value.length - 1];
-  if (!isNaN(parseInt(c))) {
-    // c is digit
-    value = parseFloat(value).toFixed(3).replace(/0+$/, '').replace(/\.$/, '');
-  }
-  else {
-    // c in not digit
-    value = parseFloat(value.substr(0, value.length - 1)).toFixed(3).replace(/0+$/, '').replace(/\.$/, '') + c;
-  }
-  return value;
+  return isNaN(parseInt(c)) ?
+  parseFloat(value.substr(0, value.length - 1)).toFixed(3).replace(/0+$/, '').replace(/\.$/, '') + c :
+    parseFloat(value).toFixed(3).replace(/0+$/, '').replace(/\.$/, '');
 };
 
 
 /**
- * Creates and returns a formatter that can convert a 'value' 
- * to 'value units/s'. 
- * 
+ * Creates and returns a formatter that can convert a 'value'
+ * to 'value units/s'.
+ *
  * @param unitsPrefix Prefix which will be used in 'unitsPrefix/s'
- * @param valueFormatter  Value itself will need further processing 
+ * @param valueFormatter  Value itself will need further processing
  *        via provided formatter. Ex: '10M requests/s'. Generally
- *        should be App.ChartLinearTimeView.DefaultFormatter. 
+ *        should be App.ChartLinearTimeView.DefaultFormatter.
  * @return {Function}
  */
 App.ChartLinearTimeView.CreateRateFormatter = function (unitsPrefix, valueFormatter) {
-  var suffix = " "+unitsPrefix+"/s";
+  var suffix = " " + unitsPrefix + "/s";
   return function (value) {
     value = valueFormatter(value) + suffix;
     return value;
   };
 };
 
-Rickshaw.GraphReopened = function(a){
+Rickshaw.GraphReopened = function (a) {
   Rickshaw.Graph.call(this, a);
 };
 
 //reopened in order to exclude "null" value from validation
 Rickshaw.GraphReopened.prototype = Object.create(Rickshaw.Graph.prototype, {
-  validateSeries : {
-    value: function(series) {
+  validateSeries: {
+    value: function (series) {
 
       if (!(series instanceof Array) && !(series instanceof Rickshaw.Series)) {
         var seriesSignature = Object.prototype.toString.apply(series);
@@ -1007,7 +996,7 @@ Rickshaw.GraphReopened.prototype = Object.create(Rickshaw.Graph.prototype, {
 
       var pointsCount;
 
-      series.forEach( function(s) {
+      series.forEach(function (s) {
 
         if (!(s instanceof Object)) {
           throw "series element is not an object: " + s;
@@ -1023,7 +1012,7 @@ Rickshaw.GraphReopened.prototype = Object.create(Rickshaw.Graph.prototype, {
 
         if (pointsCount && s.data.length != pointsCount) {
           throw "series cannot have differing numbers of points: " +
-          pointsCount	+ " vs " + s.data.length + "; see Rickshaw.Series.zeroFill()";
+          pointsCount + " vs " + s.data.length + "; see Rickshaw.Series.zeroFill()";
         }
       })
     },
@@ -1034,27 +1023,41 @@ Rickshaw.GraphReopened.prototype = Object.create(Rickshaw.Graph.prototype, {
 });
 
 //show no line if point is "null"
-Rickshaw.Graph.Renderer.Line.prototype.seriesPathFactory = function() {
+Rickshaw.Graph.Renderer.Line.prototype.seriesPathFactory = function () {
 
   var graph = this.graph;
 
   return d3.svg.line()
-    .x( function(d) { return graph.x(d.x) } )
-    .y( function(d) { return graph.y(d.y) } )
-    .defined(function(d) { return d.y!=null; })
+    .x(function (d) {
+      return graph.x(d.x)
+    })
+    .y(function (d) {
+      return graph.y(d.y)
+    })
+    .defined(function (d) {
+      return d.y != null;
+    })
     .interpolate(this.graph.interpolation).tension(this.tension);
 };
 
 //show no area if point is null
-Rickshaw.Graph.Renderer.Stack.prototype.seriesPathFactory = function() {
+Rickshaw.Graph.Renderer.Stack.prototype.seriesPathFactory = function () {
 
   var graph = this.graph;
 
   return d3.svg.area()
-    .x( function(d) { return graph.x(d.x) } )
-    .y0( function(d) { return graph.y(d.y0) } )
-    .y1( function(d) { return graph.y(d.y + d.y0) } )
-    .defined(function(d) { return d.y!=null; })
+    .x(function (d) {
+      return graph.x(d.x)
+    })
+    .y0(function (d) {
+      return graph.y(d.y0)
+    })
+    .y1(function (d) {
+      return graph.y(d.y + d.y0)
+    })
+    .defined(function (d) {
+      return d.y != null;
+    })
     .interpolate(this.graph.interpolation).tension(this.tension);
 };
 
@@ -1171,7 +1174,7 @@ App.ChartLinearTimeView.LoadAggregator = Em.Object.create({
           }, this);
         }).fail(function (jqXHR, textStatus, errorThrown) {
           _request.subRequests.forEach(function (subRequest) {
-            subRequest.context.loadDataErrorCallback.call(subRequest.context, jqXHR, textStatus, errorThrown );
+            subRequest.context.loadDataErrorCallback.call(subRequest.context, jqXHR, textStatus, errorThrown);
           }, this);
         });
       })(bulks[id]);

http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/app/views/main/dashboard/widgets/uptime_text_widget.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/uptime_text_widget.js b/ambari-web/app/views/main/dashboard/widgets/uptime_text_widget.js
index be3c962..a3290de 100644
--- a/ambari-web/app/views/main/dashboard/widgets/uptime_text_widget.js
+++ b/ambari-web/app/views/main/dashboard/widgets/uptime_text_widget.js
@@ -39,19 +39,16 @@ App.UptimeTextDashboardWidgetView = App.TextDashboardWidgetView.extend({
   modelField: null,
 
   data: null,
+
   content: null,
 
   isGreen: function () {
-    return this.get('data') != null;
+    return !Em.isNone(this.get('data'));
   }.property('data'),
 
-  isOrange: function () {
-    return false;
-  }.property('data'),
+  isOrange: false,
 
-  isRed: function () {
-    return false;
-  }.property('data'),
+  isRed: false,
 
   timeConverter: function (timestamp) {
     var m = moment((new Date(timestamp)));
@@ -73,13 +70,14 @@ App.UptimeTextDashboardWidgetView = App.TextDashboardWidgetView.extend({
   },
 
   calc: function () {
+    // don't do this.setProperties!
     this.set('data', this.calcData());
     this.set('content', this.calcContent());
   },
 
   uptimeProcessing: function (uptime) {
     var uptimeString = this.timeConverter(uptime);
-    var diff = App.dateTime() - uptime;
+    var diff = App.dateTimeWithTimeZone() - uptime;
     if (diff < 0) {
       diff = 0;
     }
@@ -102,11 +100,10 @@ App.UptimeTextDashboardWidgetView = App.TextDashboardWidgetView.extend({
         default:
           timeUnit = formatted.split(" ")[1];
       }
-      this.set('timeUnit', timeUnit);
-      this.set('hiddenInfo', []);
-      this.get('hiddenInfo').pushObject(formatted);
-      this.get('hiddenInfo').pushObject(uptimeString[0]);
-      this.get('hiddenInfo').pushObject(uptimeString[1]);
+      this.setProperties({
+        timeUnit: timeUnit,
+        hiddenInfo: [formatted, uptimeString[0], uptimeString[1]]
+      });
     }
     return formatted;
   },
@@ -114,9 +111,9 @@ App.UptimeTextDashboardWidgetView = App.TextDashboardWidgetView.extend({
   calcData: function () {
     var field = this.get('modelField');
     var uptime = this.get('model').get(field);
-    if (uptime && uptime > 0) {
-      var formatted = this.uptimeProcessing(uptime);
-      if (formatted != null) {
+    if (uptime) {
+      var formatted = this.uptimeProcessing(App.dateTimeWithTimeZone(uptime));
+      if (!Em.isNone(formatted)) {
         return parseFloat(formatted.split(" ")[0]);
       }
     }
@@ -126,11 +123,8 @@ App.UptimeTextDashboardWidgetView = App.TextDashboardWidgetView.extend({
 
   calcContent: function () {
     var data = this.get('data');
-    if (data) {
-      return data.toFixed(1) + ' ' + this.get('timeUnit');
-    }
-    else {
-      return Em.I18n.t('services.service.summary.notAvailable');
-    }
+    return data ?
+      data.toFixed(1) + ' ' + this.get('timeUnit') :
+      Em.I18n.t('services.service.summary.notAvailable');
   }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/app/views/main/host/summary.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/summary.js b/ambari-web/app/views/main/host/summary.js
index d70951d..48ff9e8 100644
--- a/ambari-web/app/views/main/host/summary.js
+++ b/ambari-web/app/views/main/host/summary.js
@@ -302,10 +302,7 @@ App.MainHostSummaryView = Em.View.extend({
    */
   timeSinceHeartBeat: function () {
     var d = this.get('content.lastHeartBeatTime');
-    if (d) {
-      return $.timeago(d);
-    }
-    return "";
+    return d ? $.timeago(d) : '';
   }.property('content.lastHeartBeatTime'),
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/app/views/main/service/reconfigure.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/reconfigure.js b/ambari-web/app/views/main/service/reconfigure.js
index aaa1ee4..dd7a8d3 100644
--- a/ambari-web/app/views/main/service/reconfigure.js
+++ b/ambari-web/app/views/main/service/reconfigure.js
@@ -48,7 +48,7 @@ App.StageLabelView = Em.View.extend({
 
   showHostPopup: function (command) {
     var controller = this.get("controller");
-    App.router.get('applicationController').dataLoading().done(function (initValue) {
+    App.router.get('userSettingsController').dataLoading('show_bg').done(function (initValue) {
       var popupView = App.HostPopup.initPopup(command.get('label'), controller, false, command.get('requestId'));
       popupView.set('isNotShowBgChecked', !initValue);
     })

http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/config.coffee
----------------------------------------------------------------------
diff --git a/ambari-web/config.coffee b/ambari-web/config.coffee
index 3410ac8..2922593 100644
--- a/ambari-web/config.coffee
+++ b/ambari-web/config.coffee
@@ -56,6 +56,7 @@ exports.config =
           'vendor/scripts/jquery.ajax-retry.js',
           'vendor/scripts/jquery.sticky-kit.js',
           'vendor/scripts/moment.js',
+          'vendor/scripts/moment-timezone-with-data-2010-2020.js',
           'vendor/scripts/workflow_visualization.js',
           'vendor/scripts/rickshaw.js',
           'vendor/scripts/spin.js',

http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/test/controllers/application_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/application_test.js b/ambari-web/test/controllers/application_test.js
index d894038..203fff0 100644
--- a/ambari-web/test/controllers/application_test.js
+++ b/ambari-web/test/controllers/application_test.js
@@ -22,7 +22,7 @@ require('models/cluster');
 
 describe('App.ApplicationController', function () {
 
-  var installerController = App.ApplicationController.create();
+  var applicationController = App.ApplicationController.create();
 
   describe('#showAboutPopup', function() {
     var dataToShowRes = {};
@@ -35,7 +35,7 @@ describe('App.ApplicationController', function () {
       App.ModalPopup.show.restore();
     });
     it ('Should send correct data to popup', function() {
-      installerController.showAboutPopup();
+      applicationController.showAboutPopup();
       dataToShowRes = JSON.parse(JSON.stringify(dataToShowRes));
       expect(dataToShowRes).to.eql({
         "header": "About",
@@ -52,61 +52,17 @@ describe('App.ApplicationController', function () {
       App.router.get.restore();
     });
     it ('Should return cluster name', function() {
-      expect(installerController.get('clusterName')).to.equal('cl1');
+      expect(applicationController.get('clusterName')).to.equal('cl1');
     });
   });
 
-  describe('#showSettingsPopup', function() {
-    var dataToShowRes = {};
 
-    beforeEach(function () {
-      sinon.stub(App.ModalPopup, 'show', function(dataToShow){
-        dataToShowRes = dataToShow;
-      });
-      sinon.stub(App, 'isAccessible').returns(true);
-      var emulatorClass = function() {};
-      emulatorClass.prototype.done = function(func) {
-        if (func) {
-          func();
-        }
-      };
-      var emulator = new emulatorClass();
-      sinon.stub(installerController, 'dataLoading').returns(emulator);
-    });
-    afterEach(function () {
-      App.isAccessible.restore();
-      App.ModalPopup.show.restore();
-      installerController.dataLoading.restore();
-    });
-    it ('Should show settings popup', function() {
-      installerController.showSettingsPopup();
-      dataToShowRes = JSON.parse(JSON.stringify(dataToShowRes));
-      expect(dataToShowRes).to.eql({
-        "header": "User Settings",
-        "primary": "Save"
-      });
-    });
-  });
 
   describe('#startKeepAlivePoller', function() {
     it ('Should change run poller state', function() {
-      installerController.set('isPollerRunning', false);
-      installerController.startKeepAlivePoller();
-      expect(installerController.get('isPollerRunning')).to.be.true;
-    });
-  });
-
-  describe('#getUserPrefErrorCallback', function() {
-    it ('Should set currentPrefObject', function() {
-      installerController.getUserPrefErrorCallback({status: 404}, {}, {});
-      expect(installerController.get('currentPrefObject')).to.be.true;
-    });
-  });
-
-  describe('#getUserPrefSuccessCallback', function() {
-    it ('Should set currentPrefObject', function() {
-      installerController.getUserPrefSuccessCallback({status: 200}, {}, {});
-      expect(installerController.get('currentPrefObject')).to.be.eql({status: 200});
+      applicationController.set('isPollerRunning', false);
+      applicationController.startKeepAlivePoller();
+      expect(applicationController.get('isPollerRunning')).to.be.true;
     });
   });
 
@@ -122,36 +78,11 @@ describe('App.ApplicationController', function () {
       App.router.route.restore();
     });
     it ('Should call route once', function() {
-      installerController.goToAdminView();
+      applicationController.goToAdminView();
       expect(result).to.be.equal('adminView');
     });
   });
 
-  describe('#dataLoading', function() {
-    beforeEach(function () {
-      sinon.stub(installerController, 'getUserPref', function(){
-        return {
-          complete: function(func) {
-            if (func) {
-              func();
-            }
-          }
-        };
-      });
-    });
-    afterEach(function () {
-      installerController.getUserPref.restore();
-    });
-    it ('Should change run poller state', function() {
-      installerController.set('currentPrefObject', {name: 'n1'});
-      installerController.dataLoading().then(function(data){
-        expect(data).to.be.eql({
-          "name": "n1"
-        });
-      });
-    });
-  });
-
   describe('#getStack', function() {
     var res;
     beforeEach(function () {
@@ -166,13 +97,12 @@ describe('App.ApplicationController', function () {
       var callback = {
         'callback': true
       };
-      installerController.getStack(callback);
+      applicationController.getStack(callback);
       res = JSON.parse(JSON.stringify(res));
       expect(res).to.be.eql({
         "name": "router.login.clusters",
         "sender": {
-          "isPollerRunning": true,
-          "currentPrefObject": null
+          "isPollerRunning": true
         },
         "callback": {
           "callback": true
@@ -183,8 +113,8 @@ describe('App.ApplicationController', function () {
 
   describe('#clusterDisplayName', function() {
     it ('Should return cluster display name', function() {
-      installerController.set('clusterName', '');
-      expect(installerController.get('clusterDisplayName')).to.equal('mycluster');
+      applicationController.set('clusterName', '');
+      expect(applicationController.get('clusterDisplayName')).to.equal('mycluster');
     });
   });
 
@@ -196,7 +126,7 @@ describe('App.ApplicationController', function () {
       App.router.get.restore();
     });
     it ('Should return true, when data loaded', function() {
-      expect(installerController.get('isClusterDataLoaded')).to.be.equal('cl1');
+      expect(applicationController.get('isClusterDataLoaded')).to.be.equal('cl1');
     });
   });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/test/controllers/global/user_settings_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/global/user_settings_controller_test.js b/ambari-web/test/controllers/global/user_settings_controller_test.js
new file mode 100644
index 0000000..99a7df2
--- /dev/null
+++ b/ambari-web/test/controllers/global/user_settings_controller_test.js
@@ -0,0 +1,74 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+var userSettingsController;
+
+describe('App.UserSettingsController', function () {
+
+  beforeEach(function () {
+    userSettingsController = App.UserSettingsController.create();
+  });
+  
+  describe('#showSettingsPopup', function() {
+    var dataToShowRes = {};
+
+    beforeEach(function () {
+      sinon.stub(App.ModalPopup, 'show', function(dataToShow){
+        dataToShowRes = dataToShow;
+      });
+      sinon.stub(App, 'isAccessible').returns(true);
+      var emulatorClass = function() {};
+      emulatorClass.prototype.done = function(func) {
+        if (func) {
+          func();
+        }
+      };
+      var emulator = new emulatorClass();
+      sinon.stub(userSettingsController, 'dataLoading').returns(emulator);
+    });
+    afterEach(function () {
+      App.isAccessible.restore();
+      App.ModalPopup.show.restore();
+      userSettingsController.dataLoading.restore();
+    });
+    it ('Should show settings popup', function() {
+      userSettingsController.showSettingsPopup();
+      dataToShowRes = JSON.parse(JSON.stringify(dataToShowRes));
+      expect(dataToShowRes).to.eql({
+        "header": "User Settings",
+        "primary": "Save"
+      });
+    });
+  });
+
+  describe('#getUserPrefErrorCallback', function() {
+    it ('Should set currentPrefObject', function() {
+      applicationController.getUserPrefErrorCallback({status: 404}, {}, {});
+      expect(applicationController.get('currentPrefObject')).to.be.true;
+    });
+  });
+
+  describe('#getUserPrefSuccessCallback', function() {
+    it ('Should set currentPrefObject', function() {
+      applicationController.getUserPrefSuccessCallback({status: 200}, {}, {});
+      expect(applicationController.get('currentPrefObject')).to.be.eql({status: 200});
+    });
+  });
+
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/test/controllers/main/host/details_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host/details_test.js b/ambari-web/test/controllers/main/host/details_test.js
index d6b7c9c..be86410 100644
--- a/ambari-web/test/controllers/main/host/details_test.js
+++ b/ambari-web/test/controllers/main/host/details_test.js
@@ -242,7 +242,7 @@ describe('App.MainHostDetailsController', function () {
     };
     beforeEach(function () {
       var stub = sinon.stub(App.router, 'get');
-      stub.withArgs('applicationController').returns({
+      stub.withArgs('userSettingsController').returns({
         dataLoading: function () {
           return mock;
         }

http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/test/views/main/dashboard/widgets/hbase_master_uptime_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/dashboard/widgets/hbase_master_uptime_test.js b/ambari-web/test/views/main/dashboard/widgets/hbase_master_uptime_test.js
index 1f365cf..3a43b54 100644
--- a/ambari-web/test/views/main/dashboard/widgets/hbase_master_uptime_test.js
+++ b/ambari-web/test/views/main/dashboard/widgets/hbase_master_uptime_test.js
@@ -23,16 +23,14 @@ require('views/main/dashboard/widgets/hbase_master_uptime');
 require('views/main/dashboard/widgets/text_widget');
 require('views/main/dashboard/widget');
 
-describe('App.HBaseMasterUptimeView', function() {
+describe('App.HBaseMasterUptimeView', function () {
 
   var tests = [
     {
       model: Em.Object.create({
-        masterStartTime: ((new Date()).getTime() - 192.1*24*3600*1000)
+        masterStartTime: ((new Date()).getTime() - 192.1 * 24 * 3600 * 1000)
       }),
       e: {
-        isRed: false,
-        isOrange: false,
         isGreen: true,
         isNA: false,
         content: '192.1 d',
@@ -40,12 +38,10 @@ describe('App.HBaseMasterUptimeView', function() {
       }
     },
     {
-      model:  Em.Object.create({
+      model: Em.Object.create({
         masterStartTime: 0
       }),
       e: {
-        isRed: false,
-        isOrange: false,
         isGreen: false,
         isNA: true,
         content: Em.I18n.t('services.service.summary.notAvailable'),
@@ -53,12 +49,10 @@ describe('App.HBaseMasterUptimeView', function() {
       }
     },
     {
-      model:  Em.Object.create({
+      model: Em.Object.create({
         masterStartTime: null
       }),
       e: {
-        isRed: false,
-        isOrange: false,
         isGreen: false,
         isNA: true,
         content: Em.I18n.t('services.service.summary.notAvailable'),
@@ -67,26 +61,28 @@ describe('App.HBaseMasterUptimeView', function() {
     }
   ];
 
-  tests.forEach(function(test) {
-    var hBaseMasterUptimeView = App.HBaseMasterUptimeView.create({model_type:null, model: test.model});
+  beforeEach(function () {
+    sinon.stub(App.router, 'get').withArgs('userSettingsController.userSettings.timezone').returns('');
+  });
+
+  afterEach(function () {
+    App.router.get.restore();
+  });
+
+  tests.forEach(function (test) {
+    var hBaseMasterUptimeView = App.HBaseMasterUptimeView.create({model_type: null, model: test.model});
     hBaseMasterUptimeView.calc();
-    describe('masterStartTime - ' + test.model.masterStartTime, function() {
-      it('content', function() {
+    describe('#masterStartTime - ' + test.model.masterStartTime, function () {
+      it('content', function () {
         expect(hBaseMasterUptimeView.get('content')).to.equal(test.e.content);
       });
-      it('data', function() {
+      it('data', function () {
         expect(hBaseMasterUptimeView.get('data')).to.equal(test.e.data);
       });
-      it('isRed', function() {
-        expect(hBaseMasterUptimeView.get('isRed')).to.equal(test.e.isRed);
-      });
-      it('isOrange', function() {
-        expect(hBaseMasterUptimeView.get('isOrange')).to.equal(test.e.isOrange);
-      });
-      it('isGreen', function() {
+      it('isGreen', function () {
         expect(hBaseMasterUptimeView.get('isGreen')).to.equal(test.e.isGreen);
       });
-      it('isNA', function() {
+      it('isNA', function () {
         expect(hBaseMasterUptimeView.get('isNA')).to.equal(test.e.isNA);
       });
     });


[2/3] ambari git commit: AMBARI-13293. Ambari Web: Set/change the timezone (onechiporenko)

Posted by on...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/deb5a06a/ambari-web/vendor/scripts/moment-timezone-with-data-2010-2020.js
----------------------------------------------------------------------
diff --git a/ambari-web/vendor/scripts/moment-timezone-with-data-2010-2020.js b/ambari-web/vendor/scripts/moment-timezone-with-data-2010-2020.js
new file mode 100644
index 0000000..cbfdf1b
--- /dev/null
+++ b/ambari-web/vendor/scripts/moment-timezone-with-data-2010-2020.js
@@ -0,0 +1,1015 @@
+//! moment-timezone.js
+//! version : 0.4.0
+//! author : Tim Wood
+//! license : MIT
+//! github.com/moment/moment-timezone
+
+(function (root, factory) {
+	"use strict";
+
+	/*global define*/
+	if (typeof define === 'function' && define.amd) {
+		define(['moment'], factory);                 // AMD
+	} else if (typeof exports === 'object') {
+		module.exports = factory(require('moment')); // Node
+	} else {
+		factory(root.moment);                        // Browser
+	}
+}(this, function (moment) {
+	"use strict";
+
+	// Do not load moment-timezone a second time.
+	if (moment.tz !== undefined) {
+		logError('Moment Timezone ' + moment.tz.version + ' was already loaded ' + (moment.tz.dataVersion ? 'with data from ' : 'without any data') + moment.tz.dataVersion);
+		return moment;
+	}
+
+	var VERSION = "0.4.0",
+		zones = {},
+		links = {},
+		names = {},
+
+		momentVersion = moment.version.split('.'),
+		major = +momentVersion[0],
+		minor = +momentVersion[1];
+
+	// Moment.js version check
+	if (major < 2 || (major === 2 && minor < 6)) {
+		logError('Moment Timezone requires Moment.js >= 2.6.0. You are using Moment.js ' + moment.version + '. See momentjs.com');
+	}
+
+	/************************************
+		Unpacking
+	************************************/
+
+	function charCodeToInt(charCode) {
+		if (charCode > 96) {
+			return charCode - 87;
+		} else if (charCode > 64) {
+			return charCode - 29;
+		}
+		return charCode - 48;
+	}
+
+	function unpackBase60(string) {
+		var i = 0,
+			parts = string.split('.'),
+			whole = parts[0],
+			fractional = parts[1] || '',
+			multiplier = 1,
+			num,
+			out = 0,
+			sign = 1;
+
+		// handle negative numbers
+		if (string.charCodeAt(0) === 45) {
+			i = 1;
+			sign = -1;
+		}
+
+		// handle digits before the decimal
+		for (i; i < whole.length; i++) {
+			num = charCodeToInt(whole.charCodeAt(i));
+			out = 60 * out + num;
+		}
+
+		// handle digits after the decimal
+		for (i = 0; i < fractional.length; i++) {
+			multiplier = multiplier / 60;
+			num = charCodeToInt(fractional.charCodeAt(i));
+			out += num * multiplier;
+		}
+
+		return out * sign;
+	}
+
+	function arrayToInt (array) {
+		for (var i = 0; i < array.length; i++) {
+			array[i] = unpackBase60(array[i]);
+		}
+	}
+
+	function intToUntil (array, length) {
+		for (var i = 0; i < length; i++) {
+			array[i] = Math.round((array[i - 1] || 0) + (array[i] * 60000)); // minutes to milliseconds
+		}
+
+		array[length - 1] = Infinity;
+	}
+
+	function mapIndices (source, indices) {
+		var out = [], i;
+
+		for (i = 0; i < indices.length; i++) {
+			out[i] = source[indices[i]];
+		}
+
+		return out;
+	}
+
+	function unpack (string) {
+		var data = string.split('|'),
+			offsets = data[2].split(' '),
+			indices = data[3].split(''),
+			untils  = data[4].split(' ');
+
+		arrayToInt(offsets);
+		arrayToInt(indices);
+		arrayToInt(untils);
+
+		intToUntil(untils, indices.length);
+
+		return {
+			name    : data[0],
+			abbrs   : mapIndices(data[1].split(' '), indices),
+			offsets : mapIndices(offsets, indices),
+			untils  : untils
+		};
+	}
+
+	/************************************
+		Zone object
+	************************************/
+
+	function Zone (packedString) {
+		if (packedString) {
+			this._set(unpack(packedString));
+		}
+	}
+
+	Zone.prototype = {
+		_set : function (unpacked) {
+			this.name    = unpacked.name;
+			this.abbrs   = unpacked.abbrs;
+			this.untils  = unpacked.untils;
+			this.offsets = unpacked.offsets;
+		},
+
+		_index : function (timestamp) {
+			var target = +timestamp,
+				untils = this.untils,
+				i;
+
+			for (i = 0; i < untils.length; i++) {
+				if (target < untils[i]) {
+					return i;
+				}
+			}
+		},
+
+		parse : function (timestamp) {
+			var target  = +timestamp,
+				offsets = this.offsets,
+				untils  = this.untils,
+				max     = untils.length - 1,
+				offset, offsetNext, offsetPrev, i;
+
+			for (i = 0; i < max; i++) {
+				offset     = offsets[i];
+				offsetNext = offsets[i + 1];
+				offsetPrev = offsets[i ? i - 1 : i];
+
+				if (offset < offsetNext && tz.moveAmbiguousForward) {
+					offset = offsetNext;
+				} else if (offset > offsetPrev && tz.moveInvalidForward) {
+					offset = offsetPrev;
+				}
+
+				if (target < untils[i] - (offset * 60000)) {
+					return offsets[i];
+				}
+			}
+
+			return offsets[max];
+		},
+
+		abbr : function (mom) {
+			return this.abbrs[this._index(mom)];
+		},
+
+		offset : function (mom) {
+			return this.offsets[this._index(mom)];
+		}
+	};
+
+	/************************************
+		Global Methods
+	************************************/
+
+	function normalizeName (name) {
+		return (name || '').toLowerCase().replace(/\//g, '_');
+	}
+
+	function addZone (packed) {
+		var i, name, normalized;
+
+		if (typeof packed === "string") {
+			packed = [packed];
+		}
+
+		for (i = 0; i < packed.length; i++) {
+			name = packed[i].split('|')[0];
+			normalized = normalizeName(name);
+			zones[normalized] = packed[i];
+			names[normalized] = name;
+		}
+	}
+
+	function getZone (name, caller) {
+		name = normalizeName(name);
+
+		var zone = zones[name];
+		var link;
+		
+		if (zone instanceof Zone) {
+			return zone;
+		}
+
+		if (typeof zone === 'string') {
+			zone = new Zone(zone);
+			zones[name] = zone;
+			return zone;
+		}
+
+		// Pass getZone to prevent recursion more than 1 level deep
+		if (links[name] && caller !== getZone && (link = getZone(links[name], getZone))) {
+			zone = zones[name] = new Zone();
+			zone._set(link);
+			zone.name = names[name];
+			return zone;
+		}
+
+		return null;
+	}
+
+	function getNames () {
+		var i, out = [];
+
+		for (i in names) {
+			if (names.hasOwnProperty(i) && (zones[i] || zones[links[i]]) && names[i]) {
+				out.push(names[i]);
+			}
+		}
+
+		return out.sort();
+	}
+
+	function addLink (aliases) {
+		var i, alias, normal0, normal1;
+
+		if (typeof aliases === "string") {
+			aliases = [aliases];
+		}
+
+		for (i = 0; i < aliases.length; i++) {
+			alias = aliases[i].split('|');
+
+			normal0 = normalizeName(alias[0]);
+			normal1 = normalizeName(alias[1]);
+
+			links[normal0] = normal1;
+			names[normal0] = alias[0];
+
+			links[normal1] = normal0;
+			names[normal1] = alias[1];
+		}
+	}
+
+	function loadData (data) {
+		addZone(data.zones);
+		addLink(data.links);
+		tz.dataVersion = data.version;
+	}
+
+	function zoneExists (name) {
+		if (!zoneExists.didShowError) {
+			zoneExists.didShowError = true;
+				logError("moment.tz.zoneExists('" + name + "') has been deprecated in favor of !moment.tz.zone('" + name + "')");
+		}
+		return !!getZone(name);
+	}
+
+	function needsOffset (m) {
+		return !!(m._a && (m._tzm === undefined));
+	}
+
+	function logError (message) {
+		if (typeof console !== 'undefined' && typeof console.error === 'function') {
+			console.error(message);
+		}
+	}
+
+	/************************************
+		moment.tz namespace
+	************************************/
+
+	function tz (input) {
+		var args = Array.prototype.slice.call(arguments, 0, -1),
+			name = arguments[arguments.length - 1],
+			zone = getZone(name),
+			out  = moment.utc.apply(null, args);
+
+		if (zone && !moment.isMoment(input) && needsOffset(out)) {
+			out.add(zone.parse(out), 'minutes');
+		}
+
+		out.tz(name);
+
+		return out;
+	}
+
+	tz.version      = VERSION;
+	tz.dataVersion  = '';
+	tz._zones       = zones;
+	tz._links       = links;
+	tz._names       = names;
+	tz.add          = addZone;
+	tz.link         = addLink;
+	tz.load         = loadData;
+	tz.zone         = getZone;
+	tz.zoneExists   = zoneExists; // deprecated in 0.1.0
+	tz.names        = getNames;
+	tz.Zone         = Zone;
+	tz.unpack       = unpack;
+	tz.unpackBase60 = unpackBase60;
+	tz.needsOffset  = needsOffset;
+	tz.moveInvalidForward   = true;
+	tz.moveAmbiguousForward = false;
+
+	/************************************
+		Interface with Moment.js
+	************************************/
+
+	var fn = moment.fn;
+
+	moment.tz = tz;
+
+	moment.defaultZone = null;
+
+	moment.updateOffset = function (mom, keepTime) {
+		var zone = moment.defaultZone,
+			offset;
+
+		if (mom._z === undefined) {
+			if (zone && needsOffset(mom) && !mom._isUTC) {
+				mom._d = moment.utc(mom._a)._d;
+				mom.utc().add(zone.parse(mom), 'minutes');
+			}
+			mom._z = zone;
+		}
+		if (mom._z) {
+			offset = mom._z.offset(mom);
+			if (Math.abs(offset) < 16) {
+				offset = offset / 60;
+			}
+			if (mom.utcOffset !== undefined) {
+				mom.utcOffset(-offset, keepTime);
+			} else {
+				mom.zone(offset, keepTime);
+			}
+		}
+	};
+
+	fn.tz = function (name) {
+		if (name) {
+			this._z = getZone(name);
+			if (this._z) {
+				moment.updateOffset(this);
+			} else {
+				logError("Moment Timezone has no data for " + name + ". See http://momentjs.com/timezone/docs/#/data-loading/.");
+			}
+			return this;
+		}
+		if (this._z) { return this._z.name; }
+	};
+
+	function abbrWrap (old) {
+		return function () {
+			if (this._z) { return this._z.abbr(this); }
+			return old.call(this);
+		};
+	}
+
+	function resetZoneWrap (old) {
+		return function () {
+			this._z = null;
+			return old.apply(this, arguments);
+		};
+	}
+
+	fn.zoneName = abbrWrap(fn.zoneName);
+	fn.zoneAbbr = abbrWrap(fn.zoneAbbr);
+	fn.utc      = resetZoneWrap(fn.utc);
+
+	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.
+	var momentProperties = moment.momentProperties;
+	if (Object.prototype.toString.call(momentProperties) === '[object Array]') {
+		// moment 2.8.1+
+		momentProperties.push('_z');
+		momentProperties.push('_a');
+	} else if (momentProperties) {
+		// moment 2.7.0
+		momentProperties._z = null;
+	}
+
+	loadData({
+		"version": "2015d",
+		"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|010101010|1Cby0 Fb0 c10 8n0 8Nd0 gL0 e10 mn0",
+			"Africa/Casablanca|WET WEST|0 -10|01010101010101010101010101010101010101010|1Cco0 Db0 1zd0 Lz0 1Nf0 wM0 co0 go0 1o00 s00 dA0 vc0 11A0 A00 e00 y00 11A0 uo0 e00 DA0 11A0 rA0 e00 Jc0 WM0 m00 gM0 M00 WM0 jc0 e00 RA0 11A0 dA0 e00 Uo0 11A0 800 gM0 Xc0",
+			"Africa/Ceuta|CET CEST|-10 -20|01010101010101010101010|1BWp0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00",
+			"Africa/Johannesburg|SAST|-20|0|",
+			"Africa/Tripoli|EET CET CEST|-20 -10 -20|0120|1IlA0 TA0 1o00",
+			"Africa/Windhoek|WAST WAT|-20 -10|01010101010101010101010|1C1c0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 11B0",
+			"America/Adak|HST HDT|a0 90|01010101010101010101010|1BR00 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0",
+			"America/Anchorage|AKST AKDT|90 80|01010101010101010101010|1BQX0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0",
+			"America/Anguilla|AST|40|0|",
+			"America/Araguaina|BRT BRST|30 20|010|1IdD0 Lz0",
+			"America/Argentina/Buenos_Aires|ART|30|0|",
+			"America/Asuncion|PYST PYT|30 40|01010101010101010101010|1C430 1a10 1fz0 1a10 1fz0 1cN0 17b0 1ip0 17b0 1ip0 17b0 1ip0 19X0 1fB0 19X0 1fB0 19X0 1ip0 17b0 1ip0 17b0 1ip0",
+			"America/Atikokan|EST|50|0|",
+			"America/Bahia|BRT BRST|30 20|010|1FJf0 Rb0",
+			"America/Bahia_Banderas|MST CDT CST|70 50 60|01212121212121212121212|1C1l0 1nW0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0",
+			"America/Belem|BRT|30|0|",
+			"America/Belize|CST|60|0|",
+			"America/Boa_Vista|AMT|40|0|",
+			"America/Bogota|COT|50|0|",
+			"America/Boise|MST MDT|70 60|01010101010101010101010|1BQV0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0",
+			"America/Campo_Grande|AMST AMT|30 40|01010101010101010101010|1BIr0 1zd0 On0 1zd0 Rb0 1zd0 Lz0 1C10 Lz0 1C10 On0 1zd0 On0 1zd0 On0 1zd0 On0 1C10 Lz0 1C10 Lz0 1C10",
+			"America/Cancun|CST CDT EST|60 50 50|010101010102|1C1k0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 Dd0",
+			"America/Caracas|VET|4u|0|",
+			"America/Cayenne|GFT|30|0|",
+			"America/Chicago|CST CDT|60 50|01010101010101010101010|1BQU0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0",
+			"America/Chihuahua|MST MDT|70 60|01010101010101010101010|1C1l0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0",
+			"America/Creston|MST|70|0|",
+			"America/Dawson|PST PDT|80 70|01010101010101010101010|1BQW0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0",
+			"America/Detroit|EST EDT|50 40|01010101010101010101010|1BQT0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0",
+			"America/Eirunepe|AMT ACT|40 50|01|1KLE0",
+			"America/Glace_Bay|AST ADT|40 30|01010101010101010101010|1BQS0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0",
+			"America/Godthab|WGT WGST|30 20|01010101010101010101010|1BWp0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00",
+			"America/Goose_Bay|AST ADT|40 30|01010101010101010101010|1BQQ1 1zb0 Op0 1zcX Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0",
+			"America/Grand_Turk|EST EDT AST|50 40 40|0101010101012|1BQT0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0",
+			"America/Guayaquil|ECT|50|0|",
+			"America/Guyana|GYT|40|0|",
+			"America/Havana|CST CDT|50 40|01010101010101010101010|1BQR0 1wo0 U00 1zc0 U00 1qM0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0",
+			"America/La_Paz|BOT|40|0|",
+			"America/Lima|PET|50|0|",
+			"America/Merida|CST CDT|60 50|01010101010101010101010|1C1k0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0",
+			"America/Metlakatla|PST|80|0|",
+			"America/Miquelon|PMST PMDT|30 20|01010101010101010101010|1BQR0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0",
+			"America/Montevideo|UYST UYT|20 30|01010101010101010101010|1BQQ0 1ld0 14n0 1ld0 14n0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 14n0 1ld0 14n0 1ld0 14n0 1o10 11z0 1o10 11z0 1o10",
+			"America/Noronha|FNT|20|0|",
+			"America/North_Dakota/Beulah|MST MDT CST CDT|70 60 60 50|01232323232323232323232|1BQV0 1zb0 Oo0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0",
+			"America/Paramaribo|SRT|30|0|",
+			"America/Port-au-Prince|EST EDT|50 40|0101010101010101010|1GI70 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0",
+			"America/Santa_Isabel|PST PDT|80 70|01010101010101010101010|1C1m0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0",
+			"America/Santiago|CLST CLT CLT|30 40 30|010101010102|1C1f0 1fB0 1nX0 G10 1EL0 Op0 1zb0 Rd0 1wn0 Rd0 1wn0",
+			"America/Sao_Paulo|BRST BRT|20 30|01010101010101010101010|1BIq0 1zd0 On0 1zd0 Rb0 1zd0 Lz0 1C10 Lz0 1C10 On0 1zd0 On0 1zd0 On0 1zd0 On0 1C10 Lz0 1C10 Lz0 1C10",
+			"America/Scoresbysund|EGT EGST|10 0|01010101010101010101010|1BWp0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00",
+			"America/St_Johns|NST NDT|3u 2u|01010101010101010101010|1BQPv 1zb0 Op0 1zcX Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0",
+			"Antarctica/Casey|CAST AWST|-b0 -80|0101|1BN30 40P0 KL0",
+			"Antarctica/Davis|DAVT DAVT|-50 -70|0101|1BPw0 3Wn0 KN0",
+			"Antarctica/DumontDUrville|DDUT|-a0|0|",
+			"Antarctica/Macquarie|AEDT MIST|-b0 -b0|01|1C140",
+			"Antarctica/Mawson|MAWT|-50|0|",
+			"Antarctica/McMurdo|NZDT NZST|-d0 -c0|01010101010101010101010|1C120 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00",
+			"Antarctica/Rothera|ROTT|30|0|",
+			"Antarctica/Syowa|SYOT|-30|0|",
+			"Antarctica/Troll|UTC CEST|0 -20|01010101010101010101010|1BWp0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00",
+			"Antarctica/Vostok|VOST|-60|0|",
+			"Asia/Aden|AST|-30|0|",
+			"Asia/Almaty|ALMT|-60|0|",
+			"Asia/Amman|EET EEST|-20 -30|010101010101010101010|1BVy0 1qM0 11A0 1o00 11A0 4bX0 Dd0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0",
+			"Asia/Anadyr|ANAT ANAST ANAT|-c0 -c0 -b0|0120|1BWe0 1qN0 WM0",
+			"Asia/Aqtau|AQTT|-50|0|",
+			"Asia/Ashgabat|TMT|-50|0|",
+			"Asia/Baku|AZT AZST|-40 -50|01010101010101010101010|1BWo0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00",
+			"Asia/Bangkok|ICT|-70|0|",
+			"Asia/Beirut|EET EEST|-20 -30|01010101010101010101010|1BWm0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0",
+			"Asia/Bishkek|KGT|-60|0|",
+			"Asia/Brunei|BNT|-80|0|",
+			"Asia/Calcutta|IST|-5u|0|",
+			"Asia/Chita|YAKT YAKST YAKT IRKT|-90 -a0 -a0 -80|01023|1BWh0 1qM0 WM0 8Hz0",
+			"Asia/Choibalsan|CHOT CHOST|-80 -90|0101010101010|1O8G0 1cJ0 1cP0 1cJ0 1cP0 1fx0 1cP0 1cJ0 1cP0 1cJ0 1cP0 1cJ0",
+			"Asia/Chongqing|CST|-80|0|",
+			"Asia/Dacca|BDT|-60|0|",
+			"Asia/Damascus|EET EEST|-20 -30|01010101010101010101010|1C0m0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0",
+			"Asia/Dili|TLT|-90|0|",
+			"Asia/Dubai|GST|-40|0|",
+			"Asia/Dushanbe|TJT|-50|0|",
+			"Asia/Gaza|EET EEST|-20 -30|01010101010101010101010|1BVW1 SKX 1xd1 MKX 1AN0 1a00 1fA0 1cL0 1cN0 1nX0 1210 1nz0 1210 1nz0 14N0 1nz0 1210 1nz0 1210 1nz0 1210 1nz0",
+			"Asia/Hebron|EET EEST|-20 -30|0101010101010101010101010|1BVy0 Tb0 1xd1 MKX bB0 cn0 1cN0 1a00 1fA0 1cL0 1cN0 1nX0 1210 1nz0 1210 1nz0 14N0 1nz0 1210 1nz0 1210 1nz0 1210 1nz0",
+			"Asia/Hong_Kong|HKT|-80|0|",
+			"Asia/Hovd|HOVT HOVST|-70 -80|0101010101010|1O8H0 1cJ0 1cP0 1cJ0 1cP0 1fx0 1cP0 1cJ0 1cP0 1cJ0 1cP0 1cJ0",
+			"Asia/Irkutsk|IRKT IRKST IRKT|-80 -90 -90|01020|1BWi0 1qM0 WM0 8Hz0",
+			"Asia/Istanbul|EET EEST|-20 -30|01010101010101010101010|1BWp0 1qM0 Xc0 1qo0 WM0 1qM0 11A0 1o00 1200 1nA0 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00",
+			"Asia/Jakarta|WIB|-70|0|",
+			"Asia/Jayapura|WIT|-90|0|",
+			"Asia/Jerusalem|IST IDT|-20 -30|01010101010101010101010|1BVA0 17X0 1kp0 1dz0 1c10 1aL0 1eN0 1oL0 10N0 1oL0 10N0 1oL0 10N0 1rz0 W10 1rz0 W10 1rz0 10N0 1oL0 10N0 1oL0",
+			"Asia/Kabul|AFT|-4u|0|",
+			"Asia/Kamchatka|PETT PETST PETT|-c0 -c0 -b0|0120|1BWe0 1qN0 WM0",
+			"Asia/Karachi|PKT|-50|0|",
+			"Asia/Kashgar|XJT|-60|0|",
+			"Asia/Kathmandu|NPT|-5J|0|",
+			"Asia/Khandyga|VLAT VLAST VLAT YAKT YAKT|-a0 -b0 -b0 -a0 -90|010234|1BWg0 1qM0 WM0 17V0 7zD0",
+			"Asia/Krasnoyarsk|KRAT KRAST KRAT|-70 -80 -80|01020|1BWj0 1qM0 WM0 8Hz0",
+			"Asia/Kuala_Lumpur|MYT|-80|0|",
+			"Asia/Magadan|MAGT MAGST MAGT MAGT|-b0 -c0 -c0 -a0|01023|1BWf0 1qM0 WM0 8Hz0",
+			"Asia/Makassar|WITA|-80|0|",
+			"Asia/Manila|PHT|-80|0|",
+			"Asia/Nicosia|EET EEST|-20 -30|01010101010101010101010|1BWp0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00",
+			"Asia/Novokuznetsk|KRAT NOVST NOVT NOVT|-70 -70 -60 -70|01230|1BWj0 1qN0 WM0 8Hz0",
+			"Asia/Novosibirsk|NOVT NOVST NOVT|-60 -70 -70|01020|1BWk0 1qM0 WM0 8Hz0",
+			"Asia/Omsk|OMST OMSST OMST|-60 -70 -70|01020|1BWk0 1qM0 WM0 8Hz0",
+			"Asia/Oral|ORAT|-50|0|",
+			"Asia/Pyongyang|KST|-90|0|",
+			"Asia/Qyzylorda|QYZT|-60|0|",
+			"Asia/Rangoon|MMT|-6u|0|",
+			"Asia/Sakhalin|SAKT SAKST SAKT|-a0 -b0 -b0|01020|1BWg0 1qM0 WM0 8Hz0",
+			"Asia/Samarkand|UZT|-50|0|",
+			"Asia/Singapore|SGT|-80|0|",
+			"Asia/Srednekolymsk|MAGT MAGST MAGT SRET|-b0 -c0 -c0 -b0|01023|1BWf0 1qM0 WM0 8Hz0",
+			"Asia/Tbilisi|GET|-40|0|",
+			"Asia/Tehran|IRST IRDT|-3u -4u|01010101010101010101010|1BTUu 1dz0 1cp0 1dz0 1cp0 1dz0 1cN0 1dz0 1cp0 1dz0 1cp0 1dz0 1cp0 1dz0 1cN0 1dz0 1cp0 1dz0 1cp0 1dz0 1cp0 1dz0",
+			"Asia/Thimbu|BTT|-60|0|",
+			"Asia/Tokyo|JST|-90|0|",
+			"Asia/Ulaanbaatar|ULAT ULAST|-80 -90|0101010101010|1O8G0 1cJ0 1cP0 1cJ0 1cP0 1fx0 1cP0 1cJ0 1cP0 1cJ0 1cP0 1cJ0",
+			"Asia/Ust-Nera|MAGT MAGST MAGT VLAT VLAT|-b0 -c0 -c0 -b0 -a0|010234|1BWf0 1qM0 WM0 17V0 7zD0",
+			"Asia/Vladivostok|VLAT VLAST VLAT|-a0 -b0 -b0|01020|1BWg0 1qM0 WM0 8Hz0",
+			"Asia/Yakutsk|YAKT YAKST YAKT|-90 -a0 -a0|01020|1BWh0 1qM0 WM0 8Hz0",
+			"Asia/Yekaterinburg|YEKT YEKST YEKT|-50 -60 -60|01020|1BWl0 1qM0 WM0 8Hz0",
+			"Asia/Yerevan|AMT AMST|-40 -50|01010|1BWm0 1qM0 WM0 1qM0",
+			"Atlantic/Azores|AZOT AZOST|10 0|01010101010101010101010|1BWp0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00",
+			"Atlantic/Canary|WET WEST|0 -10|01010101010101010101010|1BWp0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00",
+			"Atlantic/Cape_Verde|CVT|10|0|",
+			"Atlantic/South_Georgia|GST|20|0|",
+			"Atlantic/Stanley|FKST FKT|30 40|010|1C6R0 U10",
+			"Australia/ACT|AEDT AEST|-b0 -a0|01010101010101010101010|1C140 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0",
+			"Australia/Adelaide|ACDT ACST|-au -9u|01010101010101010101010|1C14u 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0",
+			"Australia/Brisbane|AEST|-a0|0|",
+			"Australia/Darwin|ACST|-9u|0|",
+			"Australia/Eucla|ACWST|-8J|0|",
+			"Australia/LHI|LHDT LHST|-b0 -au|01010101010101010101010|1C130 1cMu 1cLu 1cMu 1cLu 1fAu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1fAu 1cLu 1cMu 1cLu 1cMu",
+			"Australia/Perth|AWST|-80|0|",
+			"Chile/EasterIsland|EASST EAST EAST|50 60 50|010101010102|1C1f0 1fB0 1nX0 G10 1EL0 Op0 1zb0 Rd0 1wn0 Rd0 1wn0",
+			"Eire|GMT IST|0 -10|01010101010101010101010|1BWp0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00",
+			"Etc/GMT+1|GMT+1|10|0|",
+			"Etc/GMT+10|GMT+10|a0|0|",
+			"Etc/GMT+11|GMT+11|b0|0|",
+			"Etc/GMT+12|GMT+12|c0|0|",
+			"Etc/GMT+2|GMT+2|20|0|",
+			"Etc/GMT+3|GMT+3|30|0|",
+			"Etc/GMT+4|GMT+4|40|0|",
+			"Etc/GMT+5|GMT+5|50|0|",
+			"Etc/GMT+6|GMT+6|60|0|",
+			"Etc/GMT+7|GMT+7|70|0|",
+			"Etc/GMT+8|GMT+8|80|0|",
+			"Etc/GMT+9|GMT+9|90|0|",
+			"Etc/GMT-1|GMT-1|-10|0|",
+			"Etc/GMT-10|GMT-10|-a0|0|",
+			"Etc/GMT-11|GMT-11|-b0|0|",
+			"Etc/GMT-12|GMT-12|-c0|0|",
+			"Etc/GMT-13|GMT-13|-d0|0|",
+			"Etc/GMT-14|GMT-14|-e0|0|",
+			"Etc/GMT-2|GMT-2|-20|0|",
+			"Etc/GMT-3|GMT-3|-30|0|",
+			"Etc/GMT-4|GMT-4|-40|0|",
+			"Etc/GMT-5|GMT-5|-50|0|",
+			"Etc/GMT-6|GMT-6|-60|0|",
+			"Etc/GMT-7|GMT-7|-70|0|",
+			"Etc/GMT-8|GMT-8|-80|0|",
+			"Etc/GMT-9|GMT-9|-90|0|",
+			"Etc/UCT|UCT|0|0|",
+			"Etc/UTC|UTC|0|0|",
+			"Europe/Belfast|GMT BST|0 -10|01010101010101010101010|1BWp0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00",
+			"Europe/Kaliningrad|EET EEST FET|-20 -30 -30|01020|1BWo0 1qM0 WM0 8Hz0",
+			"Europe/Minsk|EET EEST FET MSK|-20 -30 -30 -30|01023|1BWo0 1qM0 WM0 8Hy0",
+			"Europe/Moscow|MSK MSD MSK|-30 -40 -40|01020|1BWn0 1qM0 WM0 8Hz0",
+			"Europe/Samara|SAMT SAMST SAMT|-40 -40 -30|0120|1BWm0 1qN0 WM0",
+			"Europe/Simferopol|EET EEST MSK MSK|-20 -30 -40 -30|01010101023|1BWp0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11z0 1nW0",
+			"HST|HST|a0|0|",
+			"Indian/Chagos|IOT|-60|0|",
+			"Indian/Christmas|CXT|-70|0|",
+			"Indian/Cocos|CCT|-6u|0|",
+			"Indian/Kerguelen|TFT|-50|0|",
+			"Indian/Mahe|SCT|-40|0|",
+			"Indian/Maldives|MVT|-50|0|",
+			"Indian/Mauritius|MUT|-40|0|",
+			"Indian/Reunion|RET|-40|0|",
+			"Kwajalein|MHT|-c0|0|",
+			"MET|MET MEST|-10 -20|01010101010101010101010|1BWp0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00",
+			"NZ-CHAT|CHADT CHAST|-dJ -cJ|01010101010101010101010|1C120 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00",
+			"Pacific/Apia|SST SDT WSDT WSST|b0 a0 -e0 -d0|01012323232323232323232|1Dbn0 1ff0 1a00 CI0 AQ0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00",
+			"Pacific/Bougainville|PGT BST|-a0 -b0|01|1NwE0",
+			"Pacific/Chuuk|CHUT|-a0|0|",
+			"Pacific/Efate|VUT|-b0|0|",
+			"Pacific/Enderbury|PHOT|-d0|0|",
+			"Pacific/Fakaofo|TKT TKT|b0 -d0|01|1Gfn0",
+			"Pacific/Fiji|FJST FJT|-d0 -c0|01010101010101010101010|1BWe0 1o00 Rc0 1wo0 Ao0 1Nc0 Ao0 1Q00 xz0 1SN0 uM0 1SM0 xA0 1SM0 uM0 1SM0 uM0 1SM0 uM0 1SM0 uM0 1SM0",
+			"Pacific/Funafuti|TVT|-c0|0|",
+			"Pacific/Galapagos|GALT|60|0|",
+			"Pacific/Gambier|GAMT|90|0|",
+			"Pacific/Guadalcanal|SBT|-b0|0|",
+			"Pacific/Guam|ChST|-a0|0|",
+			"Pacific/Kiritimati|LINT|-e0|0|",
+			"Pacific/Kosrae|KOST|-b0|0|",
+			"Pacific/Marquesas|MART|9u|0|",
+			"Pacific/Midway|SST|b0|0|",
+			"Pacific/Nauru|NRT|-c0|0|",
+			"Pacific/Niue|NUT|b0|0|",
+			"Pacific/Norfolk|NFT|-bu|0|",
+			"Pacific/Noumea|NCT|-b0|0|",
+			"Pacific/Palau|PWT|-90|0|",
+			"Pacific/Pohnpei|PONT|-b0|0|",
+			"Pacific/Port_Moresby|PGT|-a0|0|",
+			"Pacific/Rarotonga|CKT|a0|0|",
+			"Pacific/Tahiti|TAHT|a0|0|",
+			"Pacific/Tarawa|GILT|-c0|0|",
+			"Pacific/Tongatapu|TOT|-d0|0|",
+			"Pacific/Wake|WAKT|-c0|0|",
+			"Pacific/Wallis|WFT|-c0|0|"
+		],
+		"links": [
+			"Africa/Abidjan|Africa/Accra",
+			"Africa/Abidjan|Africa/Bamako",
+			"Africa/Abidjan|Africa/Banjul",
+			"Africa/Abidjan|Africa/Bissau",
+			"Africa/Abidjan|Africa/Conakry",
+			"Africa/Abidjan|Africa/Dakar",
+			"Africa/Abidjan|Africa/Freetown",
+			"Africa/Abidjan|Africa/Lome",
+			"Africa/Abidjan|Africa/Monrovia",
+			"Africa/Abidjan|Africa/Nouakchott",
+			"Africa/Abidjan|Africa/Ouagadougou",
+			"Africa/Abidjan|Africa/Sao_Tome",
+			"Africa/Abidjan|Africa/Timbuktu",
+			"Africa/Abidjan|America/Danmarkshavn",
+			"Africa/Abidjan|Atlantic/Reykjavik",
+			"Africa/Abidjan|Atlantic/St_Helena",
+			"Africa/Abidjan|Etc/GMT",
+			"Africa/Abidjan|Etc/GMT+0",
+			"Africa/Abidjan|Etc/GMT-0",
+			"Africa/Abidjan|Etc/GMT0",
+			"Africa/Abidjan|Etc/Greenwich",
+			"Africa/Abidjan|GMT",
+			"Africa/Abidjan|GMT+0",
+			"Africa/Abidjan|GMT-0",
+			"Africa/Abidjan|GMT0",
+			"Africa/Abidjan|Greenwich",
+			"Africa/Abidjan|Iceland",
+			"Africa/Addis_Ababa|Africa/Asmara",
+			"Africa/Addis_Ababa|Africa/Asmera",
+			"Africa/Addis_Ababa|Africa/Dar_es_Salaam",
+			"Africa/Addis_Ababa|Africa/Djibouti",
+			"Africa/Addis_Ababa|Africa/Juba",
+			"Africa/Addis_Ababa|Africa/Kampala",
+			"Africa/Addis_Ababa|Africa/Khartoum",
+			"Africa/Addis_Ababa|Africa/Mogadishu",
+			"Africa/Addis_Ababa|Africa/Nairobi",
+			"Africa/Addis_Ababa|Indian/Antananarivo",
+			"Africa/Addis_Ababa|Indian/Comoro",
+			"Africa/Addis_Ababa|Indian/Mayotte",
+			"Africa/Algiers|Africa/Tunis",
+			"Africa/Bangui|Africa/Brazzaville",
+			"Africa/Bangui|Africa/Douala",
+			"Africa/Bangui|Africa/Kinshasa",
+			"Africa/Bangui|Africa/Lagos",
+			"Africa/Bangui|Africa/Libreville",
+			"Africa/Bangui|Africa/Luanda",
+			"Africa/Bangui|Africa/Malabo",
+			"Africa/Bangui|Africa/Ndjamena",
+			"Africa/Bangui|Africa/Niamey",
+			"Africa/Bangui|Africa/Porto-Novo",
+			"Africa/Blantyre|Africa/Bujumbura",
+			"Africa/Blantyre|Africa/Gaborone",
+			"Africa/Blantyre|Africa/Harare",
+			"Africa/Blantyre|Africa/Kigali",
+			"Africa/Blantyre|Africa/Lubumbashi",
+			"Africa/Blantyre|Africa/Lusaka",
+			"Africa/Blantyre|Africa/Maputo",
+			"Africa/Cairo|Egypt",
+			"Africa/Casablanca|Africa/El_Aaiun",
+			"Africa/Ceuta|Arctic/Longyearbyen",
+			"Africa/Ceuta|Atlantic/Jan_Mayen",
+			"Africa/Ceuta|CET",
+			"Africa/Ceuta|Europe/Amsterdam",
+			"Africa/Ceuta|Europe/Andorra",
+			"Africa/Ceuta|Europe/Belgrade",
+			"Africa/Ceuta|Europe/Berlin",
+			"Africa/Ceuta|Europe/Bratislava",
+			"Africa/Ceuta|Europe/Brussels",
+			"Africa/Ceuta|Europe/Budapest",
+			"Africa/Ceuta|Europe/Busingen",
+			"Africa/Ceuta|Europe/Copenhagen",
+			"Africa/Ceuta|Europe/Gibraltar",
+			"Africa/Ceuta|Europe/Ljubljana",
+			"Africa/Ceuta|Europe/Luxembourg",
+			"Africa/Ceuta|Europe/Madrid",
+			"Africa/Ceuta|Europe/Malta",
+			"Africa/Ceuta|Europe/Monaco",
+			"Africa/Ceuta|Europe/Oslo",
+			"Africa/Ceuta|Europe/Paris",
+			"Africa/Ceuta|Europe/Podgorica",
+			"Africa/Ceuta|Europe/Prague",
+			"Africa/Ceuta|Europe/Rome",
+			"Africa/Ceuta|Europe/San_Marino",
+			"Africa/Ceuta|Europe/Sarajevo",
+			"Africa/Ceuta|Europe/Skopje",
+			"Africa/Ceuta|Europe/Stockholm",
+			"Africa/Ceuta|Europe/Tirane",
+			"Africa/Ceuta|Europe/Vaduz",
+			"Africa/Ceuta|Europe/Vatican",
+			"Africa/Ceuta|Europe/Vienna",
+			"Africa/Ceuta|Europe/Warsaw",
+			"Africa/Ceuta|Europe/Zagreb",
+			"Africa/Ceuta|Europe/Zurich",
+			"Africa/Ceuta|Poland",
+			"Africa/Johannesburg|Africa/Maseru",
+			"Africa/Johannesburg|Africa/Mbabane",
+			"Africa/Tripoli|Libya",
+			"America/Adak|America/Atka",
+			"America/Adak|US/Aleutian",
+			"America/Anchorage|America/Juneau",
+			"America/Anchorage|America/Nome",
+			"America/Anchorage|America/Sitka",
+			"America/Anchorage|America/Yakutat",
+			"America/Anchorage|US/Alaska",
+			"America/Anguilla|America/Antigua",
+			"America/Anguilla|America/Aruba",
+			"America/Anguilla|America/Barbados",
+			"America/Anguilla|America/Blanc-Sablon",
+			"America/Anguilla|America/Curacao",
+			"America/Anguilla|America/Dominica",
+			"America/Anguilla|America/Grenada",
+			"America/Anguilla|America/Guadeloupe",
+			"America/Anguilla|America/Kralendijk",
+			"America/Anguilla|America/Lower_Princes",
+			"America/Anguilla|America/Marigot",
+			"America/Anguilla|America/Martinique",
+			"America/Anguilla|America/Montserrat",
+			"America/Anguilla|America/Port_of_Spain",
+			"America/Anguilla|America/Puerto_Rico",
+			"America/Anguilla|America/Santo_Domingo",
+			"America/Anguilla|America/St_Barthelemy",
+			"America/Anguilla|America/St_Kitts",
+			"America/Anguilla|America/St_Lucia",
+			"America/Anguilla|America/St_Thomas",
+			"America/Anguilla|America/St_Vincent",
+			"America/Anguilla|America/Tortola",
+			"America/Anguilla|America/Virgin",
+			"America/Argentina/Buenos_Aires|America/Argentina/Catamarca",
+			"America/Argentina/Buenos_Aires|America/Argentina/ComodRivadavia",
+			"America/Argentina/Buenos_Aires|America/Argentina/Cordoba",
+			"America/Argentina/Buenos_Aires|America/Argentina/Jujuy",
+			"America/Argentina/Buenos_Aires|America/Argentina/La_Rioja",
+			"America/Argentina/Buenos_Aires|America/Argentina/Mendoza",
+			"America/Argentina/Buenos_Aires|America/Argentina/Rio_Gallegos",
+			"America/Argentina/Buenos_Aires|America/Argentina/Salta",
+			"America/Argentina/Buenos_Aires|America/Argentina/San_Juan",
+			"America/Argentina/Buenos_Aires|America/Argentina/San_Luis",
+			"America/Argentina/Buenos_Aires|America/Argentina/Tucuman",
+			"America/Argentina/Buenos_Aires|America/Argentina/Ushuaia",
+			"America/Argentina/Buenos_Aires|America/Buenos_Aires",
+			"America/Argentina/Buenos_Aires|America/Catamarca",
+			"America/Argentina/Buenos_Aires|America/Cordoba",
+			"America/Argentina/Buenos_Aires|America/Jujuy",
+			"America/Argentina/Buenos_Aires|America/Mendoza",
+			"America/Argentina/Buenos_Aires|America/Rosario",
+			"America/Atikokan|America/Cayman",
+			"America/Atikokan|America/Coral_Harbour",
+			"America/Atikokan|America/Jamaica",
+			"America/Atikokan|America/Panama",
+			"America/Atikokan|EST",
+			"America/Atikokan|Jamaica",
+			"America/Belem|America/Fortaleza",
+			"America/Belem|America/Maceio",
+			"America/Belem|America/Recife",
+			"America/Belem|America/Santarem",
+			"America/Belize|America/Costa_Rica",
+			"America/Belize|America/El_Salvador",
+			"America/Belize|America/Guatemala",
+			"America/Belize|America/Managua",
+			"America/Belize|America/Regina",
+			"America/Belize|America/Swift_Current",
+			"America/Belize|America/Tegucigalpa",
+			"America/Belize|Canada/East-Saskatchewan",
+			"America/Belize|Canada/Saskatchewan",
+			"America/Boa_Vista|America/Manaus",
+			"America/Boa_Vista|America/Porto_Velho",
+			"America/Boa_Vista|Brazil/West",
+			"America/Boise|America/Cambridge_Bay",
+			"America/Boise|America/Denver",
+			"America/Boise|America/Edmonton",
+			"America/Boise|America/Inuvik",
+			"America/Boise|America/Ojinaga",
+			"America/Boise|America/Shiprock",
+			"America/Boise|America/Yellowknife",
+			"America/Boise|Canada/Mountain",
+			"America/Boise|MST7MDT",
+			"America/Boise|Navajo",
+			"America/Boise|US/Mountain",
+			"America/Campo_Grande|America/Cuiaba",
+			"America/Chicago|America/Indiana/Knox",
+			"America/Chicago|America/Indiana/Tell_City",
+			"America/Chicago|America/Knox_IN",
+			"America/Chicago|America/Matamoros",
+			"America/Chicago|America/Menominee",
+			"America/Chicago|America/North_Dakota/Center",
+			"America/Chicago|America/North_Dakota/New_Salem",
+			"America/Chicago|America/Rainy_River",
+			"America/Chicago|America/Rankin_Inlet",
+			"America/Chicago|America/Resolute",
+			"America/Chicago|America/Winnipeg",
+			"America/Chicago|CST6CDT",
+			"America/Chicago|Canada/Central",
+			"America/Chicago|US/Central",
+			"America/Chicago|US/Indiana-Starke",
+			"America/Chihuahua|America/Mazatlan",
+			"America/Chihuahua|Mexico/BajaSur",
+			"America/Creston|America/Dawson_Creek",
+			"America/Creston|America/Hermosillo",
+			"America/Creston|America/Phoenix",
+			"America/Creston|MST",
+			"America/Creston|US/Arizona",
+			"America/Dawson|America/Ensenada",
+			"America/Dawson|America/Los_Angeles",
+			"America/Dawson|America/Tijuana",
+			"America/Dawson|America/Vancouver",
+			"America/Dawson|America/Whitehorse",
+			"America/Dawson|Canada/Pacific",
+			"America/Dawson|Canada/Yukon",
+			"America/Dawson|Mexico/BajaNorte",
+			"America/Dawson|PST8PDT",
+			"America/Dawson|US/Pacific",
+			"America/Dawson|US/Pacific-New",
+			"America/Detroit|America/Fort_Wayne",
+			"America/Detroit|America/Indiana/Indianapolis",
+			"America/Detroit|America/Indiana/Marengo",
+			"America/Detroit|America/Indiana/Petersburg",
+			"America/Detroit|America/Indiana/Vevay",
+			"America/Detroit|America/Indiana/Vincennes",
+			"America/Detroit|America/Indiana/Winamac",
+			"America/Detroit|America/Indianapolis",
+			"America/Detroit|America/Iqaluit",
+			"America/Detroit|America/Kentucky/Louisville",
+			"America/Detroit|America/Kentucky/Monticello",
+			"America/Detroit|America/Louisville",
+			"America/Detroit|America/Montreal",
+			"America/Detroit|America/Nassau",
+			"America/Detroit|America/New_York",
+			"America/Detroit|America/Nipigon",
+			"America/Detroit|America/Pangnirtung",
+			"America/Detroit|America/Thunder_Bay",
+			"America/Detroit|America/Toronto",
+			"America/Detroit|Canada/Eastern",
+			"America/Detroit|EST5EDT",
+			"America/Detroit|US/East-Indiana",
+			"America/Detroit|US/Eastern",
+			"America/Detroit|US/Michigan",
+			"America/Eirunepe|America/Porto_Acre",
+			"America/Eirunepe|America/Rio_Branco",
+			"America/Eirunepe|Brazil/Acre",
+			"America/Glace_Bay|America/Halifax",
+			"America/Glace_Bay|America/Moncton",
+			"America/Glace_Bay|America/Thule",
+			"America/Glace_Bay|Atlantic/Bermuda",
+			"America/Glace_Bay|Canada/Atlantic",
+			"America/Havana|Cuba",
+			"America/Merida|America/Mexico_City",
+			"America/Merida|America/Monterrey",
+			"America/Merida|Mexico/General",
+			"America/Metlakatla|Pacific/Pitcairn",
+			"America/Noronha|Brazil/DeNoronha",
+			"America/Santiago|Antarctica/Palmer",
+			"America/Santiago|Chile/Continental",
+			"America/Sao_Paulo|Brazil/East",
+			"America/St_Johns|Canada/Newfoundland",
+			"Antarctica/McMurdo|Antarctica/South_Pole",
+			"Antarctica/McMurdo|NZ",
+			"Antarctica/McMurdo|Pacific/Auckland",
+			"Asia/Aden|Asia/Baghdad",
+			"Asia/Aden|Asia/Bahrain",
+			"Asia/Aden|Asia/Kuwait",
+			"Asia/Aden|Asia/Qatar",
+			"Asia/Aden|Asia/Riyadh",
+			"Asia/Aqtau|Asia/Aqtobe",
+			"Asia/Ashgabat|Asia/Ashkhabad",
+			"Asia/Bangkok|Asia/Ho_Chi_Minh",
+			"Asia/Bangkok|Asia/Phnom_Penh",
+			"Asia/Bangkok|Asia/Saigon",
+			"Asia/Bangkok|Asia/Vientiane",
+			"Asia/Calcutta|Asia/Colombo",
+			"Asia/Calcutta|Asia/Kolkata",
+			"Asia/Chongqing|Asia/Chungking",
+			"Asia/Chongqing|Asia/Harbin",
+			"Asia/Chongqing|Asia/Macao",
+			"Asia/Chongqing|Asia/Macau",
+			"Asia/Chongqing|Asia/Shanghai",
+			"Asia/Chongqing|Asia/Taipei",
+			"Asia/Chongqing|PRC",
+			"Asia/Chongqing|ROC",
+			"Asia/Dacca|Asia/Dhaka",
+			"Asia/Dubai|Asia/Muscat",
+			"Asia/Hong_Kong|Hongkong",
+			"Asia/Istanbul|Europe/Istanbul",
+			"Asia/Istanbul|Turkey",
+			"Asia/Jakarta|Asia/Pontianak",
+			"Asia/Jerusalem|Asia/Tel_Aviv",
+			"Asia/Jerusalem|Israel",
+			"Asia/Kashgar|Asia/Urumqi",
+			"Asia/Kathmandu|Asia/Katmandu",
+			"Asia/Kuala_Lumpur|Asia/Kuching",
+			"Asia/Makassar|Asia/Ujung_Pandang",
+			"Asia/Nicosia|EET",
+			"Asia/Nicosia|Europe/Athens",
+			"Asia/Nicosia|Europe/Bucharest",
+			"Asia/Nicosia|Europe/Chisinau",
+			"Asia/Nicosia|Europe/Helsinki",
+			"Asia/Nicosia|Europe/Kiev",
+			"Asia/Nicosia|Europe/Mariehamn",
+			"Asia/Nicosia|Europe/Nicosia",
+			"Asia/Nicosia|Europe/Riga",
+			"Asia/Nicosia|Europe/Sofia",
+			"Asia/Nicosia|Europe/Tallinn",
+			"Asia/Nicosia|Europe/Tiraspol",
+			"Asia/Nicosia|Europe/Uzhgorod",
+			"Asia/Nicosia|Europe/Vilnius",
+			"Asia/Nicosia|Europe/Zaporozhye",
+			"Asia/Pyongyang|Asia/Seoul",
+			"Asia/Pyongyang|ROK",
+			"Asia/Samarkand|Asia/Tashkent",
+			"Asia/Singapore|Singapore",
+			"Asia/Tehran|Iran",
+			"Asia/Thimbu|Asia/Thimphu",
+			"Asia/Tokyo|Japan",
+			"Asia/Ulaanbaatar|Asia/Ulan_Bator",
+			"Atlantic/Canary|Atlantic/Faeroe",
+			"Atlantic/Canary|Atlantic/Faroe",
+			"Atlantic/Canary|Atlantic/Madeira",
+			"Atlantic/Canary|Europe/Lisbon",
+			"Atlantic/Canary|Portugal",
+			"Atlantic/Canary|WET",
+			"Australia/ACT|Australia/Canberra",
+			"Australia/ACT|Australia/Currie",
+			"Australia/ACT|Australia/Hobart",
+			"Australia/ACT|Australia/Melbourne",
+			"Australia/ACT|Australia/NSW",
+			"Australia/ACT|Australia/Sydney",
+			"Australia/ACT|Australia/Tasmania",
+			"Australia/ACT|Australia/Victoria",
+			"Australia/Adelaide|Australia/Broken_Hill",
+			"Australia/Adelaide|Australia/South",
+			"Australia/Adelaide|Australia/Yancowinna",
+			"Australia/Brisbane|Australia/Lindeman",
+			"Australia/Brisbane|Australia/Queensland",
+			"Australia/Darwin|Australia/North",
+			"Australia/LHI|Australia/Lord_Howe",
+			"Australia/Perth|Australia/West",
+			"Chile/EasterIsland|Pacific/Easter",
+			"Eire|Europe/Dublin",
+			"Etc/UCT|UCT",
+			"Etc/UTC|Etc/Universal",
+			"Etc/UTC|Etc/Zulu",
+			"Etc/UTC|UTC",
+			"Etc/UTC|Universal",
+			"Etc/UTC|Zulu",
+			"Europe/Belfast|Europe/Guernsey",
+			"Europe/Belfast|Europe/Isle_of_Man",
+			"Europe/Belfast|Europe/Jersey",
+			"Europe/Belfast|Europe/London",
+			"Europe/Belfast|GB",
+			"Europe/Belfast|GB-Eire",
+			"Europe/Moscow|Europe/Volgograd",
+			"Europe/Moscow|W-SU",
+			"HST|Pacific/Honolulu",
+			"HST|Pacific/Johnston",
+			"HST|US/Hawaii",
+			"Kwajalein|Pacific/Kwajalein",
+			"Kwajalein|Pacific/Majuro",
+			"NZ-CHAT|Pacific/Chatham",
+			"Pacific/Chuuk|Pacific/Truk",
+			"Pacific/Chuuk|Pacific/Yap",
+			"Pacific/Guam|Pacific/Saipan",
+			"Pacific/Midway|Pacific/Pago_Pago",
+			"Pacific/Midway|Pacific/Samoa",
+			"Pacific/Midway|US/Samoa",
+			"Pacific/Pohnpei|Pacific/Ponape"
+		]
+	});
+
+
+	return moment;
+}));