vendor: 5,917 bytes, lines 1-216
1//! moment.js 2//! version : 2.14.1 3//! authors : Tim Wood, Iskren Chernev, Moment.js contributors 4//! license : MIT 5//! momentjs.com 6 7;(function (global, factory) { 8 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : 9 typeof define === 'function' && define.amd ? define(factory) : 10 global.moment = factory() 11}(this, function () { 'use strict'; 12 13 var hookCallback; 14 15 function utils_hooks__hooks () { 16 return hookCallback.apply(null, arguments); 17 } 18 19 // This is done to register the method called with moment() 20 // without creating circular dependencies. 21 function setHookCallback (callback) { 22 hookCallback = callback; 23 } 24 25 function isArray(input) { 26 return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]'; 27 } 28 29 function isObject(input) { 30 return Object.prototype.toString.call(input) === '[object Object]'; 31 } 32 33 function isObjectEmpty(obj) { 34 var k; 35 for (k in obj) { 36 // even if its not own property I'd still call it non-empty 37 return false; 38 } 39 return true; 40 } 41 42 function isDate(input) { 43 return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]'; 44 } 45 46 function map(arr, fn) { 47 var res = [], i; 48 for (i = 0; i < arr.length; ++i) { 49 res.push(fn(arr[i], i)); 50 } 51 return res; 52 } 53 54 function hasOwnProp(a, b) { 55 return Object.prototype.hasOwnProperty.call(a, b); 56 } 57 58 function extend(a, b) { 59 for (var i in b) { 60 if (hasOwnProp(b, i)) { 61 a[i] = b[i]; 62 } 63 } 64 65 if (hasOwnProp(b, 'toString')) { 66 a.toString = b.toString; 67 } 68 69 if (hasOwnProp(b, 'valueOf')) { 70 a.valueOf = b.valueOf; 71 } 72 73 return a; 74 } 75 76 function create_utc__createUTC (input, format, locale, strict) { 77 return createLocalOrUTC(input, format, locale, strict, true).utc(); 78 } 79 80 function defaultParsingFlags() { 81 // We need to deep clone this object. 82 return { 83 empty : false, 84 unusedTokens : [], 85 unusedInput : [], 86 overflow : -2, 87 charsLeftOver : 0, 88 nullInput : false, 89 invalidMonth : null, 90 invalidFormat : false, 91 userInvalidated : false, 92 iso : false, 93 parsedDateParts : [], 94 meridiem : null 95 }; 96 } 97 98 function getParsingFlags(m) { 99 if (m._pf == null) { 100 m._pf = defaultParsingFlags(); 101 } 102 return m._pf; 103 } 104 105 var some; 106 if (Array.prototype.some) { 107 some = Array.prototype.some; 108 } else { 109 some = function (fun) { 110 var t = Object(this); 111 var len = t.length >>> 0; 112 113 for (var i = 0; i < len; i++) { 114 if (i in t && fun.call(this, t[i], i, t)) { 115 return true; 116 } 117 } 118 119 return false; 120 }; 121 } 122 123 function valid__isValid(m) { 124 if (m._isValid == null) { 125 var flags = getParsingFlags(m); 126 var parsedParts = some.call(flags.parsedDateParts, function (i) { 127 return i != null; 128 }); 129 m._isValid = !isNaN(m._d.getTime()) && 130 flags.overflow < 0 && 131 !flags.empty && 132 !flags.invalidMonth && 133 !flags.invalidWeekday && 134 !flags.nullInput && 135 !flags.invalidFormat && 136 !flags.userInvalidated && 137 (!flags.meridiem || (flags.meridiem && parsedParts)); 138 139 if (m._strict) { 140 m._isValid = m._isValid && 141 flags.charsLeftOver === 0 && 142 flags.unusedTokens.length === 0 && 143 flags.bigHour === undefined; 144 } 145 } 146 return m._isValid; 147 } 148 149 function valid__createInvalid (flags) { 150 var m = create_utc__createUTC(NaN); 151 if (flags != null) { 152 extend(getParsingFlags(m), flags); 153 } 154 else { 155 getParsingFlags(m).userInvalidated = true; 156 } 157 158 return m; 159 } 160 161 function isUndefined(input) { 162 return input === void 0; 163 } 164 165 // Plugins that add properties should also add the key here (null value), 166 // so we can properly clone ourselves. 167 var momentProperties = utils_hooks__hooks.momentProperties = []; 168 169 function copyConfig(to, from) { 170 var i, prop, val; 171 172 if (!isUndefined(from._isAMomentObject)) { 173 to._isAMomentObject = from._isAMomentObject; 174 } 175 if (!isUndefined(from._i)) { 176 to._i = from._i; 177 } 178 if (!isUndefined(from._f)) { 179 to._f = from._f; 180 } 181 if (!isUndefined(from._l)) { 182 to._l = from._l; 183 } 184 if (!isUndefined(from._strict)) { 185 to._strict = from._strict; 186 } 187 if (!isUndefined(from._tzm)) { 188 to._tzm = from._tzm; 189 } 190 if (!isUndefined(from._isUTC)) { 191 to._isUTC = from._isUTC; 192 } 193 if (!isUndefined(from._offset)) { 194 to._offset = from._offset; 195 } 196 if (!isUndefined(from._pf)) { 197 to._pf = getParsingFlags(from); 198 } 199 if (!isUndefined(from._locale)) { 200 to._locale = from._locale; 201 } 202 203 if (momentProperties.length > 0) { 204 for (i in momentProperties) { 205 prop = momentProperties[i]; 206 val = from[prop]; 207 if (!isUndefined(val)) { 208 to[prop] = val; 209 } 210 } 211 } 212 213 return to; 214 } 215 216 var updateInProgress = false;
vendor: 6,048 bytes, lines 217-414
217 218 // Moment prototype object 219 function Moment(config) { 220 copyConfig(this, config); 221 this._d = new Date(config._d != null ? config._d.getTime() : NaN); 222 // Prevent infinite loop in case updateOffset creates new moment 223 // objects. 224 if (updateInProgress === false) { 225 updateInProgress = true; 226 utils_hooks__hooks.updateOffset(this); 227 updateInProgress = false; 228 } 229 } 230 231 function isMoment (obj) { 232 return obj instanceof Moment || (obj != null && obj._isAMomentObject != null); 233 } 234 235 function absFloor (number) { 236 if (number < 0) { 237 // -0 -> 0 238 return Math.ceil(number) || 0; 239 } else { 240 return Math.floor(number); 241 } 242 } 243 244 function toInt(argumentForCoercion) { 245 var coercedNumber = +argumentForCoercion, 246 value = 0; 247 248 if (coercedNumber !== 0 && isFinite(coercedNumber)) { 249 value = absFloor(coercedNumber); 250 } 251 252 return value; 253 } 254 255 // compare two arrays, return the number of differences 256 function compareArrays(array1, array2, dontConvert) { 257 var len = Math.min(array1.length, array2.length), 258 lengthDiff = Math.abs(array1.length - array2.length), 259 diffs = 0, 260 i; 261 for (i = 0; i < len; i++) { 262 if ((dontConvert && array1[i] !== array2[i]) || 263 (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) { 264 diffs++; 265 } 266 } 267 return diffs + lengthDiff; 268 } 269 270 function warn(msg) { 271 if (utils_hooks__hooks.suppressDeprecationWarnings === false && 272 (typeof console !== 'undefined') && console.warn) { 273 console.warn('Deprecation warning: ' + msg); 274 } 275 } 276 277 function deprecate(msg, fn) { 278 var firstTime = true; 279 280 return extend(function () { 281 if (utils_hooks__hooks.deprecationHandler != null) { 282 utils_hooks__hooks.deprecationHandler(null, msg); 283 } 284 if (firstTime) { 285 warn(msg + '\nArguments: ' + Array.prototype.slice.call(arguments).join(', ') + '\n' + (new Error()).stack); 286 firstTime = false; 287 } 288 return fn.apply(this, arguments); 289 }, fn); 290 } 291 292 var deprecations = {}; 293 294 function deprecateSimple(name, msg) { 295 if (utils_hooks__hooks.deprecationHandler != null) { 296 utils_hooks__hooks.deprecationHandler(name, msg); 297 } 298 if (!deprecations[name]) { 299 warn(msg); 300 deprecations[name] = true; 301 } 302 } 303 304 utils_hooks__hooks.suppressDeprecationWarnings = false; 305 utils_hooks__hooks.deprecationHandler = null; 306 307 function isFunction(input) { 308 return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]'; 309 } 310 311 function locale_set__set (config) { 312 var prop, i; 313 for (i in config) { 314 prop = config[i]; 315 if (isFunction(prop)) { 316 this[i] = prop; 317 } else { 318 this['_' + i] = prop; 319 } 320 } 321 this._config = config; 322 // Lenient ordinal parsing accepts just a number in addition to 323 // number + (possibly) stuff coming from _ordinalParseLenient. 324 this._ordinalParseLenient = new RegExp(this._ordinalParse.source + '|' + (/\d{1,2}/).source); 325 } 326 327 function mergeConfigs(parentConfig, childConfig) { 328 var res = extend({}, parentConfig), prop; 329 for (prop in childConfig) { 330 if (hasOwnProp(childConfig, prop)) { 331 if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) { 332 res[prop] = {}; 333 extend(res[prop], parentConfig[prop]); 334 extend(res[prop], childConfig[prop]); 335 } else if (childConfig[prop] != null) { 336 res[prop] = childConfig[prop]; 337 } else { 338 delete res[prop]; 339 } 340 } 341 } 342 for (prop in parentConfig) { 343 if (hasOwnProp(parentConfig, prop) && 344 !hasOwnProp(childConfig, prop) && 345 isObject(parentConfig[prop])) { 346 // make sure changes to properties don't modify parent config 347 res[prop] = extend({}, res[prop]); 348 } 349 } 350 return res; 351 } 352 353 function Locale(config) { 354 if (config != null) { 355 this.set(config); 356 } 357 } 358 359 var keys; 360 361 if (Object.keys) { 362 keys = Object.keys; 363 } else { 364 keys = function (obj) { 365 var i, res = []; 366 for (i in obj) { 367 if (hasOwnProp(obj, i)) { 368 res.push(i); 369 } 370 } 371 return res; 372 }; 373 } 374 375 var defaultCalendar = { 376 sameDay : '[Today at] LT', 377 nextDay : '[Tomorrow at] LT', 378 nextWeek : 'dddd [at] LT', 379 lastDay : '[Yesterday at] LT', 380 lastWeek : '[Last] dddd [at] LT', 381 sameElse : 'L' 382 }; 383 384 function locale_calendar__calendar (key, mom, now) { 385 var output = this._calendar[key] || this._calendar['sameElse']; 386 return isFunction(output) ? output.call(mom, now) : output; 387 } 388 389 var defaultLongDateFormat = { 390 LTS : 'h:mm:ss A', 391 LT : 'h:mm A', 392 L : 'MM/DD/YYYY', 393 LL : 'MMMM D, YYYY', 394 LLL : 'MMMM D, YYYY h:mm A', 395 LLLL : 'dddd, MMMM D, YYYY h:mm A' 396 }; 397 398 function longDateFormat (key) { 399 var format = this._longDateFormat[key], 400 formatUpper = this._longDateFormat[key.toUpperCase()]; 401 402 if (format || !formatUpper) { 403 return format; 404 } 405 406 this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) { 407 return val.slice(1); 408 }); 409 410 return this._longDateFormat[key]; 411 } 412 413 var defaultInvalidDate = 'Invalid date'; 414
415 function invalidDate () { 416 return this._invalidDate; 417 } 418 419 var defaultOrdinal = '%d'; 420 var defaultOrdinalParse = /\d{1,2}/; 421 422 function ordinal (number) { 423 return this._ordinal.replace('%d', number); 424 } 425 426 var defaultRelativeTime = { 427 future : 'in %s', 428 past : '%s ago', 429 s : 'a few seconds', 430 m : 'a minute', 431 mm : '%d minutes', 432 h : 'an hour', 433 hh : '%d hours', 434 d : 'a day', 435 dd : '%d days', 436 M : 'a month', 437 MM : '%d months', 438 y : 'a year', 439 yy : '%d years' 440 }; 441 442 function relative__relativeTime (number, withoutSuffix, string, isFuture) { 443 var output = this._relativeTime[string]; 444 return (isFunction(output)) ? 445 output(number, withoutSuffix, string, isFuture) : 446 output.replace(/%d/i, number); 447 } 448 449 function pastFuture (diff, output) { 450 var format = this._relativeTime[diff > 0 ? 'future' : 'past']; 451 return isFunction(format) ? format(output) : format.replace(/%s/i, output); 452 } 453 454 var aliases = {}; 455 456 function addUnitAlias (unit, shorthand) { 457 var lowerCase = unit.toLowerCase(); 458 aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit; 459 } 460 461 function normalizeUnits(units) { 462 return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined; 463 } 464 465 function normalizeObjectUnits(inputObject) { 466 var normalizedInput = {}, 467 normalizedProp, 468 prop; 469 470 for (prop in inputObject) { 471 if (hasOwnProp(inputObject, prop)) { 472 normalizedProp = normalizeUnits(prop); 473 if (normalizedProp) { 474 normalizedInput[normalizedProp] = inputObject[prop]; 475 } 476 } 477 } 478 479 return normalizedInput; 480 } 481 482 var priorities = {}; 483 484 function addUnitPriority(unit, priority) { 485 priorities[unit] = priority; 486 } 487 488 function getPrioritizedUnits(unitsObj) { 489 var units = []; 490 for (var u in unitsObj) { 491 units.push({unit: u, priority: priorities[u]}); 492 } 493 units.sort(function (a, b) { 494 return a.priority - b.priority; 495 }); 496 return units; 497 } 498 499 function makeGetSet (unit, keepTime) { 500 return function (value) { 501 if (value != null) { 502 get_set__set(this, unit, value); 503 utils_hooks__hooks.updateOffset(this, keepTime); 504 return this; 505 } else { 506 return get_set__get(this, unit); 507 } 508 }; 509 } 510 511 function get_set__get (mom, unit) { 512 return mom.isValid() ? 513 mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN; 514 } 515 516 function get_set__set (mom, unit, value) { 517 if (mom.isValid()) { 518 mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); 519 } 520 } 521 522 // MOMENTS 523 524 function stringGet (units) { 525 units = normalizeUnits(units); 526 if (isFunction(this[units])) { 527 return this[units](); 528 } 529 return this; 530 } 531 532 533 function stringSet (units, value) { 534 if (typeof units === 'object') { 535 units = normalizeObjectUnits(units); 536 var prioritized = getPrioritizedUnits(units); 537 for (var i = 0; i < prioritized.length; i++) { 538 this[prioritized[i].unit](units[prioritized[i].unit]); 539 } 540 } else { 541 units = normalizeUnits(units); 542 if (isFunction(this[units])) { 543 return this[units](value); 544 } 545 } 546 return this; 547 } 548 549 function zeroFill(number, targetLength, forceSign) { 550 var absNumber = '' + Math.abs(number), 551 zerosToFill = targetLength - absNumber.length, 552 sign = number >= 0; 553 return (sign ? (forceSign ? '+' : '') : '-') + 554 Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber; 555 } 556 557 var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}
vendor: 79,654 bytes, lines 557-2910
557|x|X|zz?|ZZ?|.)/g; 558 559 var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g; 560 561 var formatFunctions = {}; 562 563 var formatTokenFunctions = {}; 564 565 // token: 'M' 566 // padded: ['MM', 2] 567 // ordinal: 'Mo' 568 // callback: function () { this.month() + 1 } 569 function addFormatToken (token, padded, ordinal, callback) { 570 var func = callback; 571 if (typeof callback === 'string') { 572 func = function () { 573 return this[callback](); 574 }; 575 } 576 if (token) { 577 formatTokenFunctions[token] = func; 578 } 579 if (padded) { 580 formatTokenFunctions[padded[0]] = function () { 581 return zeroFill(func.apply(this, arguments), padded[1], padded[2]); 582 }; 583 } 584 if (ordinal) { 585 formatTokenFunctions[ordinal] = function () { 586 return this.localeData().ordinal(func.apply(this, arguments), token); 587 }; 588 } 589 } 590 591 function removeFormattingTokens(input) { 592 if (input.match(/\[[\s\S]/)) { 593 return input.replace(/^\[|\]$/g, ''); 594 } 595 return input.replace(/\\/g, ''); 596 } 597 598 function makeFormatFunction(format) { 599 var array = format.match(formattingTokens), i, length; 600 601 for (i = 0, length = array.length; i < length; i++) { 602 if (formatTokenFunctions[array[i]]) { 603 array[i] = formatTokenFunctions[array[i]]; 604 } else { 605 array[i] = removeFormattingTokens(array[i]); 606 } 607 } 608 609 return function (mom) { 610 var output = '', i; 611 for (i = 0; i < length; i++) { 612 output += array[i] instanceof Function ? array[i].call(mom, format) : array[i]; 613 } 614 return output; 615 }; 616 } 617 618 // format date using native date object 619 function formatMoment(m, format) { 620 if (!m.isValid()) { 621 return m.localeData().invalidDate(); 622 } 623 624 format = expandFormat(format, m.localeData()); 625 formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format); 626 627 return formatFunctions[format](m); 628 } 629 630 function expandFormat(format, locale) { 631 var i = 5; 632 633 function replaceLongDateFormatTokens(input) { 634 return locale.longDateFormat(input) || input; 635 } 636 637 localFormattingTokens.lastIndex = 0; 638 while (i >= 0 && localFormattingTokens.test(format)) { 639 format = format.replace(localFormattingTokens, replaceLongDateFormatTokens); 640 localFormattingTokens.lastIndex = 0; 641 i -= 1; 642 } 643 644 return format; 645 } 646 647 var match1 = /\d/; // 0 - 9 648 var match2 = /\d\d/; // 00 - 99 649 var match3 = /\d{3}/; // 000 - 999 650 var match4 = /\d{4}/; // 0000 - 9999 651 var match6 = /[+-]?\d{6}/; // -999999 - 999999 652 var match1to2 = /\d\d?/; // 0 - 99 653 var match3to4 = /\d\d\d\d?/; // 999 - 9999 654 var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999 655 var match1to3 = /\d{1,3}/; // 0 - 999 656 var match1to4 = /\d{1,4}/; // 0 - 9999 657 var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999 658 659 var matchUnsigned = /\d+/; // 0 - inf 660 var matchSigned = /[+-]?\d+/; // -inf - inf 661 662 var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z 663 var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z 664 665 var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123 666 667 // any word (or two) characters or numbers including two/three word month in arabic. 668 // includes scottish gaelic two word and hyphenated months 669 var matchWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i; 670 671 672 var regexes = {}; 673 674 function addRegexToken (token, regex, strictRegex) { 675 regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) { 676 return (isStrict && strictRegex) ? strictRegex : regex; 677 }; 678 } 679 680 function getParseRegexForToken (token, config) { 681 if (!hasOwnProp(regexes, token)) { 682 return new RegExp(unescapeFormat(token)); 683 } 684 685 return regexes[token](config._strict, config._locale); 686 } 687 688 // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript 689 function unescapeFormat(s) { 690 return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) { 691 return p1 || p2 || p3 || p4; 692 })); 693 } 694 695 function regexEscape(s) { 696 return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); 697 } 698 699 var tokens = {}; 700 701 function addParseToken (token, callback) { 702 var i, func = callback; 703 if (typeof token === 'string') { 704 token = [token]; 705 } 706 if (typeof callback === 'number') { 707 func = function (input, array) { 708 array[callback] = toInt(input); 709 }; 710 } 711 for (i = 0; i < token.length; i++) { 712 tokens[token[i]] = func; 713 } 714 } 715 716 function addWeekParseToken (token, callback) { 717 addParseToken(token, function (input, array, config, token) { 718 config._w = config._w || {}; 719 callback(input, config._w, config, token); 720 }); 721 } 722 723 function addTimeToArrayFromToken(token, input, config) { 724 if (input != null && hasOwnProp(tokens, token)) { 725 tokens[token](input, config._a, config, token); 726 } 727 } 728 729 var YEAR = 0; 730 var MONTH = 1; 731 var DATE = 2; 732 var HOUR = 3; 733 var MINUTE = 4; 734 var SECOND = 5; 735 var MILLISECOND = 6; 736 var WEEK = 7; 737 var WEEKDAY = 8; 738 739 var indexOf; 740 741 if (Array.prototype.indexOf) { 742 indexOf = Array.prototype.indexOf; 743 } else { 744 indexOf = function (o) { 745 // I know 746 var i; 747 for (i = 0; i < this.length; ++i) { 748 if (this[i] === o) { 749 return i; 750 } 751 } 752 return -1; 753 }; 754 } 755 756 function daysInMonth(year, month) { 757 return new Date(Date.UTC(year, month + 1, 0)).getUTCDate(); 758 } 759 760 // FORMATTING 761 762 addFormatToken('M', ['MM', 2], 'Mo', function () { 763 return this.month() + 1; 764 }); 765 766 addFormatToken('MMM', 0, 0, function (format) { 767 return this.localeData().monthsShort(this, format); 768 }); 769 770 addFormatToken('MMMM', 0, 0, function (format) { 771 return this.localeData().months(this, format); 772 }); 773 774 // ALIASES 775 776 addUnitAlias('month', 'M'); 777 778 // PRIORITY 779 780 addUnitPriority('month', 8); 781 782 // PARSING 783 784 addRegexToken('M', match1to2); 785 addRegexToken('MM', match1to2, match2); 786 addRegexToken('MMM', function (isStrict, locale) { 787 return locale.monthsShortRegex(isStrict); 788 }); 789 addRegexToken('MMMM', function (isStrict, locale) { 790 return locale.monthsRegex(isStrict); 791 }); 792 793 addParseToken(['M', 'MM'], function (input, array) { 794 array[MONTH] = toInt(input) - 1; 795 }); 796 797 addParseToken(['MMM', 'MMMM'], function (input, array, config, token) { 798 var month = config._locale.monthsParse(input, token, config._strict); 799 // if we didn't find a month name, mark the date as invalid. 800 if (month != null) { 801 array[MONTH] = month; 802 } else { 803 getParsingFlags(config).invalidMonth = input; 804 } 805 }); 806 807 // LOCALES 808 809 var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/; 810 var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'); 811 function localeMonths (m, format) { 812 return isArray(this._months) ? this._months[m.month()] : 813 this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()]; 814 } 815 816 var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'); 817 function localeMonthsShort (m, format) { 818 return isArray(this._monthsShort) ? this._monthsShort[m.month()] : 819 this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()]; 820 } 821 822 function units_month__handleStrictParse(monthName, format, strict) { 823 var i, ii, mom, llc = monthName.toLocaleLowerCase(); 824 if (!this._monthsParse) { 825 // this is not used 826 this._monthsParse = []; 827 this._longMonthsParse = []; 828 this._shortMonthsParse = []; 829 for (i = 0; i < 12; ++i) { 830 mom = create_utc__createUTC([2000, i]); 831 this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase(); 832 this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase(); 833 } 834 } 835 836 if (strict) { 837 if (format === 'MMM') { 838 ii = indexOf.call(this._shortMonthsParse, llc); 839 return ii !== -1 ? ii : null; 840 } else { 841 ii = indexOf.call(this._longMonthsParse, llc); 842 return ii !== -1 ? ii : null; 843 } 844 } else { 845 if (format === 'MMM') { 846 ii = indexOf.call(this._shortMonthsParse, llc); 847 if (ii !== -1) { 848 return ii; 849 } 850 ii = indexOf.call(this._longMonthsParse, llc); 851 return ii !== -1 ? ii : null; 852 } else { 853 ii = indexOf.call(this._longMonthsParse, llc); 854 if (ii !== -1) { 855 return ii; 856 } 857 ii = indexOf.call(this._shortMonthsParse, llc); 858 return ii !== -1 ? ii : null; 859 } 860 } 861 } 862 863 function localeMonthsParse (monthName, format, strict) { 864 var i, mom, regex; 865 866 if (this._monthsParseExact) { 867 return units_month__handleStrictParse.call(this, monthName, format, strict); 868 } 869 870 if (!this._monthsParse) { 871 this._monthsParse = []; 872 this._longMonthsParse = []; 873 this._shortMonthsParse = []; 874 } 875 876 // TODO: add sorting 877 // Sorting makes sure if one month (or abbr) is a prefix of another 878 // see sorting in computeMonthsParse 879 for (i = 0; i < 12; i++) { 880 // make the regex if we don't have it already 881 mom = create_utc__createUTC([2000, i]); 882 if (strict && !this._longMonthsParse[i]) { 883 this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i'); 884 this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i'); 885 } 886 if (!strict && !this._monthsParse[i]) { 887 regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, ''); 888 this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i'); 889 } 890 // test the regex 891 if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) { 892 return i; 893 } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) { 894 return i; 895 } else if (!strict && this._monthsParse[i].test(monthName)) { 896 return i; 897 } 898 } 899 } 900 901 // MOMENTS 902 903 function setMonth (mom, value) { 904 var dayOfMonth; 905 906 if (!mom.isValid()) { 907 // No op 908 return mom; 909 } 910 911 if (typeof value === 'string') { 912 if (/^\d+$/.test(value)) { 913 value = toInt(value); 914 } else { 915 value = mom.localeData().monthsParse(value); 916 // TODO: Another silent failure? 917 if (typeof value !== 'number') { 918 return mom; 919 } 920 } 921 } 922 923 dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value)); 924 mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth); 925 return mom; 926 } 927 928 function getSetMonth (value) { 929 if (value != null) { 930 setMonth(this, value); 931 utils_hooks__hooks.updateOffset(this, true); 932 return this; 933 } else { 934 return get_set__get(this, 'Month'); 935 } 936 } 937 938 function getDaysInMonth () { 939 return daysInMonth(this.year(), this.month()); 940 } 941 942 var defaultMonthsShortRegex = matchWord; 943 function monthsShortRegex (isStrict) { 944 if (this._monthsParseExact) { 945 if (!hasOwnProp(this, '_monthsRegex')) { 946 computeMonthsParse.call(this); 947 } 948 if (isStrict) { 949 return this._monthsShortStrictRegex; 950 } else { 951 return this._monthsShortRegex; 952 } 953 } else { 954 if (!hasOwnProp(this, '_monthsShortRegex')) { 955 this._monthsShortRegex = defaultMonthsShortRegex; 956 } 957 return this._monthsShortStrictRegex && isStrict ? 958 this._monthsShortStrictRegex : this._monthsShortRegex; 959 } 960 } 961 962 var defaultMonthsRegex = matchWord; 963 function monthsRegex (isStrict) { 964 if (this._monthsParseExact) { 965 if (!hasOwnProp(this, '_monthsRegex')) { 966 computeMonthsParse.call(this); 967 } 968 if (isStrict) { 969 return this._monthsStrictRegex; 970 } else { 971 return this._monthsRegex; 972 } 973 } else { 974 if (!hasOwnProp(this, '_monthsRegex')) { 975 this._monthsRegex = defaultMonthsRegex; 976 } 977 return this._monthsStrictRegex && isStrict ? 978 this._monthsStrictRegex : this._monthsRegex; 979 } 980 } 981 982 function computeMonthsParse () { 983 function cmpLenRev(a, b) { 984 return b.length - a.length; 985 } 986 987 var shortPieces = [], longPieces = [], mixedPieces = [], 988 i, mom; 989 for (i = 0; i < 12; i++) { 990 // make the regex if we don't have it already 991 mom = create_utc__createUTC([2000, i]); 992 shortPieces.push(this.monthsShort(mom, '')); 993 longPieces.push(this.months(mom, '')); 994 mixedPieces.push(this.months(mom, '')); 995 mixedPieces.push(this.monthsShort(mom, '')); 996 } 997 // Sorting makes sure if one month (or abbr) is a prefix of another it 998 // will match the longer piece. 999 shortPieces.sort(cmpLenRev); 1000 longPieces.sort(cmpLenRev); 1001 mixedPieces.sort(cmpLenRev); 1002 for (i = 0; i < 12; i++) { 1003 shortPieces[i] = regexEscape(shortPieces[i]); 1004 longPieces[i] = regexEscape(longPieces[i]); 1005 } 1006 for (i = 0; i < 24; i++) { 1007 mixedPieces[i] = regexEscape(mixedPieces[i]); 1008 } 1009 1010 this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); 1011 this._monthsShortRegex = this._monthsRegex; 1012 this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); 1013 this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); 1014 } 1015 1016 // FORMATTING 1017 1018 addFormatToken('Y', 0, 0, function () { 1019 var y = this.year(); 1020 return y <= 9999 ? '' + y : '+' + y; 1021 }); 1022 1023 addFormatToken(0, ['YY', 2], 0, function () { 1024 return this.year() % 100; 1025 }); 1026 1027 addFormatToken(0, ['YYYY', 4], 0, 'year'); 1028 addFormatToken(0, ['YYYYY', 5], 0, 'year'); 1029 addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); 1030 1031 // ALIASES 1032 1033 addUnitAlias('year', 'y'); 1034 1035 // PRIORITIES 1036 1037 addUnitPriority('year', 1); 1038 1039 // PARSING 1040 1041 addRegexToken('Y', matchSigned); 1042 addRegexToken('YY', match1to2, match2); 1043 addRegexToken('YYYY', match1to4, match4); 1044 addRegexToken('YYYYY', match1to6, match6); 1045 addRegexToken('YYYYYY', match1to6, match6); 1046 1047 addParseToken(['YYYYY', 'YYYYYY'], YEAR); 1048 addParseToken('YYYY', function (input, array) { 1049 array[YEAR] = input.length === 2 ? utils_hooks__hooks.parseTwoDigitYear(input) : toInt(input); 1050 }); 1051 addParseToken('YY', function (input, array) { 1052 array[YEAR] = utils_hooks__hooks.parseTwoDigitYear(input); 1053 }); 1054 addParseToken('Y', function (input, array) { 1055 array[YEAR] = parseInt(input, 10); 1056 }); 1057 1058 // HELPERS 1059 1060 function daysInYear(year) { 1061 return isLeapYear(year) ? 366 : 365; 1062 } 1063 1064 function isLeapYear(year) { 1065 return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; 1066 } 1067 1068 // HOOKS 1069 1070 utils_hooks__hooks.parseTwoDigitYear = function (input) { 1071 return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); 1072 }; 1073 1074 // MOMENTS 1075 1076 var getSetYear = makeGetSet('FullYear', true); 1077 1078 function getIsLeapYear () { 1079 return isLeapYear(this.year()); 1080 } 1081 1082 function createDate (y, m, d, h, M, s, ms) { 1083 //can't just apply() to create a date: 1084 //http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply 1085 var date = new Date(y, m, d, h, M, s, ms); 1086 1087 //the date constructor remaps years 0-99 to 1900-1999 1088 if (y < 100 && y >= 0 && isFinite(date.getFullYear())) { 1089 date.setFullYear(y); 1090 } 1091 return date; 1092 } 1093 1094 function createUTCDate (y) { 1095 var date = new Date(Date.UTC.apply(null, arguments)); 1096 1097 //the Date.UTC function remaps years 0-99 to 1900-1999 1098 if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) { 1099 date.setUTCFullYear(y); 1100 } 1101 return date; 1102 } 1103 1104 // start-of-first-week - start-of-year 1105 function firstWeekOffset(year, dow, doy) { 1106 var // first-week day -- which january is always in the first week (4 for iso, 1 for other) 1107 fwd = 7 + dow - doy, 1108 // first-week day local weekday -- which local weekday is fwd 1109 fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7; 1110 1111 return -fwdlw + fwd - 1; 1112 } 1113 1114 //http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday 1115 function dayOfYearFromWeeks(year, week, weekday, dow, doy) { 1116 var localWeekday = (7 + weekday - dow) % 7, 1117 weekOffset = firstWeekOffset(year, dow, doy), 1118 dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, 1119 resYear, resDayOfYear; 1120 1121 if (dayOfYear <= 0) { 1122 resYear = year - 1; 1123 resDayOfYear = daysInYear(resYear) + dayOfYear; 1124 } else if (dayOfYear > daysInYear(year)) { 1125 resYear = year + 1; 1126 resDayOfYear = dayOfYear - daysInYear(year); 1127 } else { 1128 resYear = year; 1129 resDayOfYear = dayOfYear; 1130 } 1131 1132 return { 1133 year: resYear, 1134 dayOfYear: resDayOfYear 1135 }; 1136 } 1137 1138 function weekOfYear(mom, dow, doy) { 1139 var weekOffset = firstWeekOffset(mom.year(), dow, doy), 1140 week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, 1141 resWeek, resYear; 1142 1143 if (week < 1) { 1144 resYear = mom.year() - 1; 1145 resWeek = week + weeksInYear(resYear, dow, doy); 1146 } else if (week > weeksInYear(mom.year(), dow, doy)) { 1147 resWeek = week - weeksInYear(mom.year(), dow, doy); 1148 resYear = mom.year() + 1; 1149 } else { 1150 resYear = mom.year(); 1151 resWeek = week; 1152 } 1153 1154 return { 1155 week: resWeek, 1156 year: resYear 1157 }; 1158 } 1159 1160 function weeksInYear(year, dow, doy) { 1161 var weekOffset = firstWeekOffset(year, dow, doy), 1162 weekOffsetNext = firstWeekOffset(year + 1, dow, doy); 1163 return (daysInYear(year) - weekOffset + weekOffsetNext) / 7; 1164 } 1165 1166 // FORMATTING 1167 1168 addFormatToken('w', ['ww', 2], 'wo', 'week'); 1169 addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek'); 1170 1171 // ALIASES 1172 1173 addUnitAlias('week', 'w'); 1174 addUnitAlias('isoWeek', 'W'); 1175 1176 // PRIORITIES 1177 1178 addUnitPriority('week', 5); 1179 addUnitPriority('isoWeek', 5); 1180 1181 // PARSING 1182 1183 addRegexToken('w', match1to2); 1184 addRegexToken('ww', match1to2, match2); 1185 addRegexToken('W', match1to2); 1186 addRegexToken('WW', match1to2, match2); 1187 1188 addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) { 1189 week[token.substr(0, 1)] = toInt(input); 1190 }); 1191 1192 // HELPERS 1193 1194 // LOCALES 1195 1196 function localeWeek (mom) { 1197 return weekOfYear(mom, this._week.dow, this._week.doy).week; 1198 } 1199 1200 var defaultLocaleWeek = { 1201 dow : 0, // Sunday is the first day of the week. 1202 doy : 6 // The week that contains Jan 1st is the first week of the year. 1203 }; 1204 1205 function localeFirstDayOfWeek () { 1206 return this._week.dow; 1207 } 1208 1209 function localeFirstDayOfYear () { 1210 return this._week.doy; 1211 } 1212 1213 // MOMENTS 1214 1215 function getSetWeek (input) { 1216 var week = this.localeData().week(this); 1217 return input == null ? week : this.add((input - week) * 7, 'd'); 1218 } 1219 1220 function getSetISOWeek (input) { 1221 var week = weekOfYear(this, 1, 4).week; 1222 return input == null ? week : this.add((input - week) * 7, 'd'); 1223 } 1224 1225 // FORMATTING 1226 1227 addFormatToken('d', 0, 'do', 'day'); 1228 1229 addFormatToken('dd', 0, 0, function (format) { 1230 return this.localeData().weekdaysMin(this, format); 1231 }); 1232 1233 addFormatToken('ddd', 0, 0, function (format) { 1234 return this.localeData().weekdaysShort(this, format); 1235 }); 1236 1237 addFormatToken('dddd', 0, 0, function (format) { 1238 return this.localeData().weekdays(this, format); 1239 }); 1240 1241 addFormatToken('e', 0, 0, 'weekday'); 1242 addFormatToken('E', 0, 0, 'isoWeekday'); 1243 1244 // ALIASES 1245 1246 addUnitAlias('day', 'd'); 1247 addUnitAlias('weekday', 'e'); 1248 addUnitAlias('isoWeekday', 'E'); 1249 1250 // PRIORITY 1251 addUnitPriority('day', 11); 1252 addUnitPriority('weekday', 11); 1253 addUnitPriority('isoWeekday', 11); 1254 1255 // PARSING 1256 1257 addRegexToken('d', match1to2); 1258 addRegexToken('e', match1to2); 1259 addRegexToken('E', match1to2); 1260 addRegexToken('dd', function (isStrict, locale) { 1261 return locale.weekdaysMinRegex(isStrict); 1262 }); 1263 addRegexToken('ddd', function (isStrict, locale) { 1264 return locale.weekdaysShortRegex(isStrict); 1265 }); 1266 addRegexToken('dddd', function (isStrict, locale) { 1267 return locale.weekdaysRegex(isStrict); 1268 }); 1269 1270 addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) { 1271 var weekday = config._locale.weekdaysParse(input, token, config._strict); 1272 // if we didn't get a weekday name, mark the date as invalid 1273 if (weekday != null) { 1274 week.d = weekday; 1275 } else { 1276 getParsingFlags(config).invalidWeekday = input; 1277 } 1278 }); 1279 1280 addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) { 1281 week[token] = toInt(input); 1282 }); 1283 1284 // HELPERS 1285 1286 function parseWeekday(input, locale) { 1287 if (typeof input !== 'string') { 1288 return input; 1289 } 1290 1291 if (!isNaN(input)) { 1292 return parseInt(input, 10); 1293 } 1294 1295 input = locale.weekdaysParse(input); 1296 if (typeof input === 'number') { 1297 return input; 1298 } 1299 1300 return null; 1301 } 1302 1303 function parseIsoWeekday(input, locale) { 1304 if (typeof input === 'string') { 1305 return locale.weekdaysParse(input) % 7 || 7; 1306 } 1307 return isNaN(input) ? null : input; 1308 } 1309 1310 // LOCALES 1311 1312 var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'); 1313 function localeWeekdays (m, format) { 1314 return isArray(this._weekdays) ? this._weekdays[m.day()] : 1315 this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()]; 1316 } 1317 1318 var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'); 1319 function localeWeekdaysShort (m) { 1320 return this._weekdaysShort[m.day()]; 1321 } 1322 1323 var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'); 1324 function localeWeekdaysMin (m) { 1325 return this._weekdaysMin[m.day()]; 1326 } 1327 1328 function day_of_week__handleStrictParse(weekdayName, format, strict) { 1329 var i, ii, mom, llc = weekdayName.toLocaleLowerCase(); 1330 if (!this._weekdaysParse) { 1331 this._weekdaysParse = []; 1332 this._shortWeekdaysParse = []; 1333 this._minWeekdaysParse = []; 1334 1335 for (i = 0; i < 7; ++i) { 1336 mom = create_utc__createUTC([2000, 1]).day(i); 1337 this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase(); 1338 this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase(); 1339 this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase(); 1340 } 1341 } 1342 1343 if (strict) { 1344 if (format === 'dddd') { 1345 ii = indexOf.call(this._weekdaysParse, llc); 1346 return ii !== -1 ? ii : null; 1347 } else if (format === 'ddd') { 1348 ii = indexOf.call(this._shortWeekdaysParse, llc); 1349 return ii !== -1 ? ii : null; 1350 } else { 1351 ii = indexOf.call(this._minWeekdaysParse, llc); 1352 return ii !== -1 ? ii : null; 1353 } 1354 } else { 1355 if (format === 'dddd') { 1356 ii = indexOf.call(this._weekdaysParse, llc); 1357 if (ii !== -1) { 1358 return ii; 1359 } 1360 ii = indexOf.call(this._shortWeekdaysParse, llc); 1361 if (ii !== -1) { 1362 return ii; 1363 } 1364 ii = indexOf.call(this._minWeekdaysParse, llc); 1365 return ii !== -1 ? ii : null; 1366 } else if (format === 'ddd') { 1367 ii = indexOf.call(this._shortWeekdaysParse, llc); 1368 if (ii !== -1) { 1369 return ii; 1370 } 1371 ii = indexOf.call(this._weekdaysParse, llc); 1372 if (ii !== -1) { 1373 return ii; 1374 } 1375 ii = indexOf.call(this._minWeekdaysParse, llc); 1376 return ii !== -1 ? ii : null; 1377 } else { 1378 ii = indexOf.call(this._minWeekdaysParse, llc); 1379 if (ii !== -1) { 1380 return ii; 1381 } 1382 ii = indexOf.call(this._weekdaysParse, llc); 1383 if (ii !== -1) { 1384 return ii; 1385 } 1386 ii = indexOf.call(this._shortWeekdaysParse, llc); 1387 return ii !== -1 ? ii : null; 1388 } 1389 } 1390 } 1391 1392 function localeWeekdaysParse (weekdayName, format, strict) { 1393 var i, mom, regex; 1394 1395 if (this._weekdaysParseExact) { 1396 return day_of_week__handleStrictParse.call(this, weekdayName, format, strict); 1397 } 1398 1399 if (!this._weekdaysParse) { 1400 this._weekdaysParse = []; 1401 this._minWeekdaysParse = []; 1402 this._shortWeekdaysParse = []; 1403 this._fullWeekdaysParse = []; 1404 } 1405 1406 for (i = 0; i < 7; i++) { 1407 // make the regex if we don't have it already 1408 1409 mom = create_utc__createUTC([2000, 1]).day(i); 1410 if (strict && !this._fullWeekdaysParse[i]) { 1411 this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\.?') + '$', 'i'); 1412 this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\.?') + '$', 'i'); 1413 this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\.?') + '$', 'i'); 1414 } 1415 if (!this._weekdaysParse[i]) { 1416 regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, ''); 1417 this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i'); 1418 } 1419 // test the regex 1420 if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) { 1421 return i; 1422 } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) { 1423 return i; 1424 } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) { 1425 return i; 1426 } else if (!strict && this._weekdaysParse[i].test(weekdayName)) { 1427 return i; 1428 } 1429 } 1430 } 1431 1432 // MOMENTS 1433 1434 function getSetDayOfWeek (input) { 1435 if (!this.isValid()) { 1436 return input != null ? this : NaN; 1437 } 1438 var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); 1439 if (input != null) { 1440 input = parseWeekday(input, this.localeData()); 1441 return this.add(input - day, 'd'); 1442 } else { 1443 return day; 1444 } 1445 } 1446 1447 function getSetLocaleDayOfWeek (input) { 1448 if (!this.isValid()) { 1449 return input != null ? this : NaN; 1450 } 1451 var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7; 1452 return input == null ? weekday : this.add(input - weekday, 'd'); 1453 } 1454 1455 function getSetISODayOfWeek (input) { 1456 if (!this.isValid()) { 1457 return input != null ? this : NaN; 1458 } 1459 1460 // behaves the same as moment#day except 1461 // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6) 1462 // as a setter, sunday should belong to the previous week. 1463 1464 if (input != null) { 1465 var weekday = parseIsoWeekday(input, this.localeData()); 1466 return this.day(this.day() % 7 ? weekday : weekday - 7); 1467 } else { 1468 return this.day() || 7; 1469 } 1470 } 1471 1472 var defaultWeekdaysRegex = matchWord; 1473 function weekdaysRegex (isStrict) { 1474 if (this._weekdaysParseExact) { 1475 if (!hasOwnProp(this, '_weekdaysRegex')) { 1476 computeWeekdaysParse.call(this); 1477 } 1478 if (isStrict) { 1479 return this._weekdaysStrictRegex; 1480 } else { 1481 return this._weekdaysRegex; 1482 } 1483 } else { 1484 if (!hasOwnProp(this, '_weekdaysRegex')) { 1485 this._weekdaysRegex = defaultWeekdaysRegex; 1486 } 1487 return this._weekdaysStrictRegex && isStrict ? 1488 this._weekdaysStrictRegex : this._weekdaysRegex; 1489 } 1490 } 1491 1492 var defaultWeekdaysShortRegex = matchWord; 1493 function weekdaysShortRegex (isStrict) { 1494 if (this._weekdaysParseExact) { 1495 if (!hasOwnProp(this, '_weekdaysRegex')) { 1496 computeWeekdaysParse.call(this); 1497 } 1498 if (isStrict) { 1499 return this._weekdaysShortStrictRegex; 1500 } else { 1501 return this._weekdaysShortRegex; 1502 } 1503 } else { 1504 if (!hasOwnProp(this, '_weekdaysShortRegex')) { 1505 this._weekdaysShortRegex = defaultWeekdaysShortRegex; 1506 } 1507 return this._weekdaysShortStrictRegex && isStrict ? 1508 this._weekdaysShortStrictRegex : this._weekdaysShortRegex; 1509 } 1510 } 1511 1512 var defaultWeekdaysMinRegex = matchWord; 1513 function weekdaysMinRegex (isStrict) { 1514 if (this._weekdaysParseExact) { 1515 if (!hasOwnProp(this, '_weekdaysRegex')) { 1516 computeWeekdaysParse.call(this); 1517 } 1518 if (isStrict) { 1519 return this._weekdaysMinStrictRegex; 1520 } else { 1521 return this._weekdaysMinRegex; 1522 } 1523 } else { 1524 if (!hasOwnProp(this, '_weekdaysMinRegex')) { 1525 this._weekdaysMinRegex = defaultWeekdaysMinRegex; 1526 } 1527 return this._weekdaysMinStrictRegex && isStrict ? 1528 this._weekdaysMinStrictRegex : this._weekdaysMinRegex; 1529 } 1530 } 1531 1532 1533 function computeWeekdaysParse () { 1534 function cmpLenRev(a, b) { 1535 return b.length - a.length; 1536 } 1537 1538 var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [], 1539 i, mom, minp, shortp, longp; 1540 for (i = 0; i < 7; i++) { 1541 // make the regex if we don't have it already 1542 mom = create_utc__createUTC([2000, 1]).day(i); 1543 minp = this.weekdaysMin(mom, ''); 1544 shortp = this.weekdaysShort(mom, ''); 1545 longp = this.weekdays(mom, ''); 1546 minPieces.push(minp); 1547 shortPieces.push(shortp); 1548 longPieces.push(longp); 1549 mixedPieces.push(minp); 1550 mixedPieces.push(shortp); 1551 mixedPieces.push(longp); 1552 } 1553 // Sorting makes sure if one weekday (or abbr) is a prefix of another it 1554 // will match the longer piece. 1555 minPieces.sort(cmpLenRev); 1556 shortPieces.sort(cmpLenRev); 1557 longPieces.sort(cmpLenRev); 1558 mixedPieces.sort(cmpLenRev); 1559 for (i = 0; i < 7; i++) { 1560 shortPieces[i] = regexEscape(shortPieces[i]); 1561 longPieces[i] = regexEscape(longPieces[i]); 1562 mixedPieces[i] = regexEscape(mixedPieces[i]); 1563 } 1564 1565 this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); 1566 this._weekdaysShortRegex = this._weekdaysRegex; 1567 this._weekdaysMinRegex = this._weekdaysRegex; 1568 1569 this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); 1570 this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); 1571 this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i'); 1572 } 1573 1574 // FORMATTING 1575 1576 function hFormat() { 1577 return this.hours() % 12 || 12; 1578 } 1579 1580 function kFormat() { 1581 return this.hours() || 24; 1582 } 1583 1584 addFormatToken('H', ['HH', 2], 0, 'hour'); 1585 addFormatToken('h', ['hh', 2], 0, hFormat); 1586 addFormatToken('k', ['kk', 2], 0, kFormat); 1587 1588 addFormatToken('hmm', 0, 0, function () { 1589 return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2); 1590 }); 1591 1592 addFormatToken('hmmss', 0, 0, function () { 1593 return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) + 1594 zeroFill(this.seconds(), 2); 1595 }); 1596 1597 addFormatToken('Hmm', 0, 0, function () { 1598 return '' + this.hours() + zeroFill(this.minutes(), 2); 1599 }); 1600 1601 addFormatToken('Hmmss', 0, 0, function () { 1602 return '' + this.hours() + zeroFill(this.minutes(), 2) + 1603 zeroFill(this.seconds(), 2); 1604 }); 1605 1606 function meridiem (token, lowercase) { 1607 addFormatToken(token, 0, 0, function () { 1608 return this.localeData().meridiem(this.hours(), this.minutes(), lowercase); 1609 }); 1610 } 1611 1612 meridiem('a', true); 1613 meridiem('A', false); 1614 1615 // ALIASES 1616 1617 addUnitAlias('hour', 'h'); 1618 1619 // PRIORITY 1620 addUnitPriority('hour', 13); 1621 1622 // PARSING 1623 1624 function matchMeridiem (isStrict, locale) { 1625 return locale._meridiemParse; 1626 } 1627 1628 addRegexToken('a', matchMeridiem); 1629 addRegexToken('A', matchMeridiem); 1630 addRegexToken('H', match1to2); 1631 addRegexToken('h', match1to2); 1632 addRegexToken('HH', match1to2, match2); 1633 addRegexToken('hh', match1to2, match2); 1634 1635 addRegexToken('hmm', match3to4); 1636 addRegexToken('hmmss', match5to6); 1637 addRegexToken('Hmm', match3to4); 1638 addRegexToken('Hmmss', match5to6); 1639 1640 addParseToken(['H', 'HH'], HOUR); 1641 addParseToken(['a', 'A'], function (input, array, config) { 1642 config._isPm = config._locale.isPM(input); 1643 config._meridiem = input; 1644 }); 1645 addParseToken(['h', 'hh'], function (input, array, config) { 1646 array[HOUR] = toInt(input); 1647 getParsingFlags(config).bigHour = true; 1648 }); 1649 addParseToken('hmm', function (input, array, config) { 1650 var pos = input.length - 2; 1651 array[HOUR] = toInt(input.substr(0, pos)); 1652 array[MINUTE] = toInt(input.substr(pos)); 1653 getParsingFlags(config).bigHour = true; 1654 }); 1655 addParseToken('hmmss', function (input, array, config) { 1656 var pos1 = input.length - 4; 1657 var pos2 = input.length - 2; 1658 array[HOUR] = toInt(input.substr(0, pos1)); 1659 array[MINUTE] = toInt(input.substr(pos1, 2)); 1660 array[SECOND] = toInt(input.substr(pos2)); 1661 getParsingFlags(config).bigHour = true; 1662 }); 1663 addParseToken('Hmm', function (input, array, config) { 1664 var pos = input.length - 2; 1665 array[HOUR] = toInt(input.substr(0, pos)); 1666 array[MINUTE] = toInt(input.substr(pos)); 1667 }); 1668 addParseToken('Hmmss', function (input, array, config) { 1669 var pos1 = input.length - 4; 1670 var pos2 = input.length - 2; 1671 array[HOUR] = toInt(input.substr(0, pos1)); 1672 array[MINUTE] = toInt(input.substr(pos1, 2)); 1673 array[SECOND] = toInt(input.substr(pos2)); 1674 }); 1675 1676 // LOCALES 1677 1678 function localeIsPM (input) { 1679 // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays 1680 // Using charAt should be more compatible. 1681 return ((input + '').toLowerCase().charAt(0) === 'p'); 1682 } 1683 1684 var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i; 1685 function localeMeridiem (hours, minutes, isLower) { 1686 if (hours > 11) { 1687 return isLower ? 'pm' : 'PM'; 1688 } else { 1689 return isLower ? 'am' : 'AM'; 1690 } 1691 } 1692 1693 1694 // MOMENTS 1695 1696 // Setting the hour should keep the time, because the user explicitly 1697 // specified which hour he wants. So trying to maintain the same hour (in 1698 // a new timezone) makes sense. Adding/subtracting hours does not follow 1699 // this rule. 1700 var getSetHour = makeGetSet('Hours', true); 1701 1702 var baseConfig = { 1703 calendar: defaultCalendar, 1704 longDateFormat: defaultLongDateFormat, 1705 invalidDate: defaultInvalidDate, 1706 ordinal: defaultOrdinal, 1707 ordinalParse: defaultOrdinalParse, 1708 relativeTime: defaultRelativeTime, 1709 1710 months: defaultLocaleMonths, 1711 monthsShort: defaultLocaleMonthsShort, 1712 1713 week: defaultLocaleWeek, 1714 1715 weekdays: defaultLocaleWeekdays, 1716 weekdaysMin: defaultLocaleWeekdaysMin, 1717 weekdaysShort: defaultLocaleWeekdaysShort, 1718 1719 meridiemParse: defaultLocaleMeridiemParse 1720 }; 1721 1722 // internal storage for locale config files 1723 var locales = {}; 1724 var globalLocale; 1725 1726 function normalizeLocale(key) { 1727 return key ? key.toLowerCase().replace('_', '-') : key; 1728 } 1729 1730 // pick the locale from the array 1731 // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each 1732 // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root 1733 function chooseLocale(names) { 1734 var i = 0, j, next, locale, split; 1735 1736 while (i < names.length) { 1737 split = normalizeLocale(names[i]).split('-'); 1738 j = split.length; 1739 next = normalizeLocale(names[i + 1]); 1740 next = next ? next.split('-') : null; 1741 while (j > 0) { 1742 locale = loadLocale(split.slice(0, j).join('-')); 1743 if (locale) { 1744 return locale; 1745 } 1746 if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) { 1747 //the next array item is better than a shallower substring of this one 1748 break; 1749 } 1750 j--; 1751 } 1752 i++; 1753 } 1754 return null; 1755 } 1756 1757 function loadLocale(name) { 1758 var oldLocale = null; 1759 // TODO: Find a better way to register and load all the locales in Node 1760 if (!locales[name] && (typeof module !== 'undefined') && 1761 module && module.exports) { 1762 try { 1763 oldLocale = globalLocale._abbr; 1764 require('./locale/' + name); 1765 // because defineLocale currently also sets the global locale, we 1766 // want to undo that for lazy loaded locales 1767 locale_locales__getSetGlobalLocale(oldLocale); 1768 } catch (e) { } 1769 } 1770 return locales[name]; 1771 } 1772 1773 // This function will load locale and then set the global locale. If 1774 // no arguments are passed in, it will simply return the current global 1775 // locale key. 1776 function locale_locales__getSetGlobalLocale (key, values) { 1777 var data; 1778 if (key) { 1779 if (isUndefined(values)) { 1780 data = locale_locales__getLocale(key); 1781 } 1782 else { 1783 data = defineLocale(key, values); 1784 } 1785 1786 if (data) { 1787 // moment.duration._locale = moment._locale = data; 1788 globalLocale = data; 1789 } 1790 } 1791 1792 return globalLocale._abbr; 1793 } 1794 1795 function defineLocale (name, config) { 1796 if (config !== null) { 1797 var parentConfig = baseConfig; 1798 config.abbr = name; 1799 if (locales[name] != null) { 1800 deprecateSimple('defineLocaleOverride', 1801 'use moment.updateLocale(localeName, config) to change ' + 1802 'an existing locale. moment.defineLocale(localeName, ' + 1803 'config) should only be used for creating a new locale ' + 1804 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'); 1805 parentConfig = locales[name]._config; 1806 } else if (config.parentLocale != null) { 1807 if (locales[config.parentLocale] != null) { 1808 parentConfig = locales[config.parentLocale]._config; 1809 } else { 1810 // treat as if there is no base config 1811 deprecateSimple('parentLocaleUndefined', 1812 'specified parentLocale is not defined yet. See http://momentjs.com/guides/#/warnings/parent-locale/'); 1813 } 1814 } 1815 locales[name] = new Locale(mergeConfigs(parentConfig, config)); 1816 1817 // backwards compat for now: also set the locale 1818 locale_locales__getSetGlobalLocale(name); 1819 1820 return locales[name]; 1821 } else { 1822 // useful for testing 1823 delete locales[name]; 1824 return null; 1825 } 1826 } 1827 1828 function updateLocale(name, config) { 1829 if (config != null) { 1830 var locale, parentConfig = baseConfig; 1831 // MERGE 1832 if (locales[name] != null) { 1833 parentConfig = locales[name]._config; 1834 } 1835 config = mergeConfigs(parentConfig, config); 1836 locale = new Locale(config); 1837 locale.parentLocale = locales[name]; 1838 locales[name] = locale; 1839 1840 // backwards compat for now: also set the locale 1841 locale_locales__getSetGlobalLocale(name); 1842 } else { 1843 // pass null for config to unupdate, useful for tests 1844 if (locales[name] != null) { 1845 if (locales[name].parentLocale != null) { 1846 locales[name] = locales[name].parentLocale; 1847 } else if (locales[name] != null) { 1848 delete locales[name]; 1849 } 1850 } 1851 } 1852 return locales[name]; 1853 } 1854 1855 // returns locale data 1856 function locale_locales__getLocale (key) { 1857 var locale; 1858 1859 if (key && key._locale && key._locale._abbr) { 1860 key = key._locale._abbr; 1861 } 1862 1863 if (!key) { 1864 return globalLocale; 1865 } 1866 1867 if (!isArray(key)) { 1868 //short-circuit everything else 1869 locale = loadLocale(key); 1870 if (locale) { 1871 return locale; 1872 } 1873 key = [key]; 1874 } 1875 1876 return chooseLocale(key); 1877 } 1878 1879 function locale_locales__listLocales() { 1880 return keys(locales); 1881 } 1882 1883 function checkOverflow (m) { 1884 var overflow; 1885 var a = m._a; 1886 1887 if (a && getParsingFlags(m).overflow === -2) { 1888 overflow = 1889 a[MONTH] < 0 || a[MONTH] > 11 ? MONTH : 1890 a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE : 1891 a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR : 1892 a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE : 1893 a[SECOND] < 0 || a[SECOND] > 59 ? SECOND : 1894 a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND : 1895 -1; 1896 1897 if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) { 1898 overflow = DATE; 1899 } 1900 if (getParsingFlags(m)._overflowWeeks && overflow === -1) { 1901 overflow = WEEK; 1902 } 1903 if (getParsingFlags(m)._overflowWeekday && overflow === -1) { 1904 overflow = WEEKDAY; 1905 } 1906 1907 getParsingFlags(m).overflow = overflow; 1908 } 1909 1910 return m; 1911 } 1912 1913 // iso 8601 regex 1914 // 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) 1915 var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/; 1916 var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/; 1917 1918 var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/; 1919 1920 var isoDates = [ 1921 ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/], 1922 ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/], 1923 ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/], 1924 ['GGGG-[W]WW', /\d{4}-W\d\d/, false], 1925 ['YYYY-DDD', /\d{4}-\d{3}/], 1926 ['YYYY-MM', /\d{4}-\d\d/, false], 1927 ['YYYYYYMMDD', /[+-]\d{10}/], 1928 ['YYYYMMDD', /\d{8}/], 1929 // YYYYMM is NOT allowed by the standard 1930 ['GGGG[W]WWE', /\d{4}W\d{3}/], 1931 ['GGGG[W]WW', /\d{4}W\d{2}/, false], 1932 ['YYYYDDD', /\d{7}/] 1933 ]; 1934 1935 // iso time formats and regexes 1936 var isoTimes = [ 1937 ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/], 1938 ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/], 1939 ['HH:mm:ss', /\d\d:\d\d:\d\d/], 1940 ['HH:mm', /\d\d:\d\d/], 1941 ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/], 1942 ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/], 1943 ['HHmmss', /\d\d\d\d\d\d/], 1944 ['HHmm', /\d\d\d\d/], 1945 ['HH', /\d\d/] 1946 ]; 1947 1948 var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i; 1949 1950 // date from iso format 1951 function configFromISO(config) { 1952 var i, l, 1953 string = config._i, 1954 match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), 1955 allowTime, dateFormat, timeFormat, tzFormat; 1956 1957 if (match) { 1958 getParsingFlags(config).iso = true; 1959 1960 for (i = 0, l = isoDates.length; i < l; i++) { 1961 if (isoDates[i][1].exec(match[1])) { 1962 dateFormat = isoDates[i][0]; 1963 allowTime = isoDates[i][2] !== false; 1964 break; 1965 } 1966 } 1967 if (dateFormat == null) { 1968 config._isValid = false; 1969 return; 1970 } 1971 if (match[3]) { 1972 for (i = 0, l = isoTimes.length; i < l; i++) { 1973 if (isoTimes[i][1].exec(match[3])) { 1974 // match[2] should be 'T' or space 1975 timeFormat = (match[2] || ' ') + isoTimes[i][0]; 1976 break; 1977 } 1978 } 1979 if (timeFormat == null) { 1980 config._isValid = false; 1981 return; 1982 } 1983 } 1984 if (!allowTime && timeFormat != null) { 1985 config._isValid = false; 1986 return; 1987 } 1988 if (match[4]) { 1989 if (tzRegex.exec(match[4])) { 1990 tzFormat = 'Z'; 1991 } else { 1992 config._isValid = false; 1993 return; 1994 } 1995 } 1996 config._f = dateFormat + (timeFormat || '') + (tzFormat || ''); 1997 configFromStringAndFormat(config); 1998 } else { 1999 config._isValid = false; 2000 } 2001 } 2002 2003 // date from iso format or fallback 2004 function configFromString(config) { 2005 var matched = aspNetJsonRegex.exec(config._i); 2006 2007 if (matched !== null) { 2008 config._d = new Date(+matched[1]); 2009 return; 2010 } 2011 2012 configFromISO(config); 2013 if (config._isValid === false) { 2014 delete config._isValid; 2015 utils_hooks__hooks.createFromInputFallback(config); 2016 } 2017 } 2018 2019 utils_hooks__hooks.createFromInputFallback = deprecate( 2020 'moment construction falls back to js Date. This is ' + 2021 'discouraged and will be removed in upcoming major ' + 2022 'release. Please refer to ' + 2023 'http://momentjs.com/guides/#/warnings/js-date/ for more info.', 2024 function (config) { 2025 config._d = new Date(config._i + (config._useUTC ? ' UTC' : '')); 2026 } 2027 ); 2028 2029 // Pick the first defined of two or three arguments. 2030 function defaults(a, b, c) { 2031 if (a != null) { 2032 return a; 2033 } 2034 if (b != null) { 2035 return b; 2036 } 2037 return c; 2038 } 2039 2040 function currentDateArray(config) { 2041 // hooks is actually the exported moment object 2042 var nowValue = new Date(utils_hooks__hooks.now()); 2043 if (config._useUTC) { 2044 return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()]; 2045 } 2046 return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()]; 2047 } 2048 2049 // convert an array to a date. 2050 // the array should mirror the parameters below 2051 // note: all values past the year are optional and will default to the lowest possible value. 2052 // [year, month, day , hour, minute, second, millisecond] 2053 function configFromArray (config) { 2054 var i, date, input = [], currentDate, yearToUse; 2055 2056 if (config._d) { 2057 return; 2058 } 2059 2060 currentDate = currentDateArray(config); 2061 2062 //compute day of the year from weeks and weekdays 2063 if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { 2064 dayOfYearFromWeekInfo(config); 2065 } 2066 2067 //if the day of the year is set, figure out what it is 2068 if (config._dayOfYear) { 2069 yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); 2070 2071 if (config._dayOfYear > daysInYear(yearToUse)) { 2072 getParsingFlags(config)._overflowDayOfYear = true; 2073 } 2074 2075 date = createUTCDate(yearToUse, 0, config._dayOfYear); 2076 config._a[MONTH] = date.getUTCMonth(); 2077 config._a[DATE] = date.getUTCDate(); 2078 } 2079 2080 // Default to current date. 2081 // * if no year, month, day of month are given, default to today 2082 // * if day of month is given, default month and year 2083 // * if month is given, default only year 2084 // * if year is given, don't default anything 2085 for (i = 0; i < 3 && config._a[i] == null; ++i) { 2086 config._a[i] = input[i] = currentDate[i]; 2087 } 2088 2089 // Zero out whatever was not defaulted, including time 2090 for (; i < 7; i++) { 2091 config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i]; 2092 } 2093 2094 // Check for 24:00:00.000 2095 if (config._a[HOUR] === 24 && 2096 config._a[MINUTE] === 0 && 2097 config._a[SECOND] === 0 && 2098 config._a[MILLISECOND] === 0) { 2099 config._nextDay = true; 2100 config._a[HOUR] = 0; 2101 } 2102 2103 config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input); 2104 // Apply timezone offset from input. The actual utcOffset can be changed 2105 // with parseZone. 2106 if (config._tzm != null) { 2107 config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); 2108 } 2109 2110 if (config._nextDay) { 2111 config._a[HOUR] = 24; 2112 } 2113 } 2114 2115 function dayOfYearFromWeekInfo(config) { 2116 var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow; 2117 2118 w = config._w; 2119 if (w.GG != null || w.W != null || w.E != null) { 2120 dow = 1; 2121 doy = 4; 2122 2123 // TODO: We need to take the current isoWeekYear, but that depends on 2124 // how we interpret now (local, utc, fixed offset). So create 2125 // a now version of current config (take local/utc/offset flags, and 2126 // create now). 2127 weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(local__createLocal(), 1, 4).year); 2128 week = defaults(w.W, 1); 2129 weekday = defaults(w.E, 1); 2130 if (weekday < 1 || weekday > 7) { 2131 weekdayOverflow = true; 2132 } 2133 } else { 2134 dow = config._locale._week.dow; 2135 doy = config._locale._week.doy; 2136 2137 weekYear = defaults(w.gg, config._a[YEAR], weekOfYear(local__createLocal(), dow, doy).year); 2138 week = defaults(w.w, 1); 2139 2140 if (w.d != null) { 2141 // weekday -- low day numbers are considered next week 2142 weekday = w.d; 2143 if (weekday < 0 || weekday > 6) { 2144 weekdayOverflow = true; 2145 } 2146 } else if (w.e != null) { 2147 // local weekday -- counting starts from begining of week 2148 weekday = w.e + dow; 2149 if (w.e < 0 || w.e > 6) { 2150 weekdayOverflow = true; 2151 } 2152 } else { 2153 // default to begining of week 2154 weekday = dow; 2155 } 2156 } 2157 if (week < 1 || week > weeksInYear(weekYear, dow, doy)) { 2158 getParsingFlags(config)._overflowWeeks = true; 2159 } else if (weekdayOverflow != null) { 2160 getParsingFlags(config)._overflowWeekday = true; 2161 } else { 2162 temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy); 2163 config._a[YEAR] = temp.year; 2164 config._dayOfYear = temp.dayOfYear; 2165 } 2166 } 2167 2168 // constant that refers to the ISO standard 2169 utils_hooks__hooks.ISO_8601 = function () {}; 2170 2171 // date from string and format string 2172 function configFromStringAndFormat(config) { 2173 // TODO: Move this to another part of the creation flow to prevent circular deps 2174 if (config._f === utils_hooks__hooks.ISO_8601) { 2175 configFromISO(config); 2176 return; 2177 } 2178 2179 config._a = []; 2180 getParsingFlags(config).empty = true; 2181 2182 // This array is used to make a Date, either with `new Date` or `Date.UTC` 2183 var string = '' + config._i, 2184 i, parsedInput, tokens, token, skipped, 2185 stringLength = string.length, 2186 totalParsedInputLength = 0; 2187 2188 tokens = expandFormat(config._f, config._locale).match(formattingTokens) || []; 2189 2190 for (i = 0; i < tokens.length; i++) { 2191 token = tokens[i]; 2192 parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; 2193 // console.log('token', token, 'parsedInput', parsedInput, 2194 // 'regex', getParseRegexForToken(token, config)); 2195 if (parsedInput) { 2196 skipped = string.substr(0, string.indexOf(parsedInput)); 2197 if (skipped.length > 0) { 2198 getParsingFlags(config).unusedInput.push(skipped); 2199 } 2200 string = string.slice(string.indexOf(parsedInput) + parsedInput.length); 2201 totalParsedInputLength += parsedInput.length; 2202 } 2203 // don't parse if it's not a known token 2204 if (formatTokenFunctions[token]) { 2205 if (parsedInput) { 2206 getParsingFlags(config).empty = false; 2207 } 2208 else { 2209 getParsingFlags(config).unusedTokens.push(token); 2210 } 2211 addTimeToArrayFromToken(token, parsedInput, config); 2212 } 2213 else if (config._strict && !parsedInput) { 2214 getParsingFlags(config).unusedTokens.push(token); 2215 } 2216 } 2217 2218 // add remaining unparsed input length to the string 2219 getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength; 2220 if (string.length > 0) { 2221 getParsingFlags(config).unusedInput.push(string); 2222 } 2223 2224 // clear _12h flag if hour is <= 12 2225 if (config._a[HOUR] <= 12 && 2226 getParsingFlags(config).bigHour === true && 2227 config._a[HOUR] > 0) { 2228 getParsingFlags(config).bigHour = undefined; 2229 } 2230 2231 getParsingFlags(config).parsedDateParts = config._a.slice(0); 2232 getParsingFlags(config).meridiem = config._meridiem; 2233 // handle meridiem 2234 config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem); 2235 2236 configFromArray(config); 2237 checkOverflow(config); 2238 } 2239 2240 2241 function meridiemFixWrap (locale, hour, meridiem) { 2242 var isPm; 2243 2244 if (meridiem == null) { 2245 // nothing to do 2246 return hour; 2247 } 2248 if (locale.meridiemHour != null) { 2249 return locale.meridiemHour(hour, meridiem); 2250 } else if (locale.isPM != null) { 2251 // Fallback 2252 isPm = locale.isPM(meridiem); 2253 if (isPm && hour < 12) { 2254 hour += 12; 2255 } 2256 if (!isPm && hour === 12) { 2257 hour = 0; 2258 } 2259 return hour; 2260 } else { 2261 // this is not supposed to happen 2262 return hour; 2263 } 2264 } 2265 2266 // date from string and array of format strings 2267 function configFromStringAndArray(config) { 2268 var tempConfig, 2269 bestMoment, 2270 2271 scoreToBeat, 2272 i, 2273 currentScore; 2274 2275 if (config._f.length === 0) { 2276 getParsingFlags(config).invalidFormat = true; 2277 config._d = new Date(NaN); 2278 return; 2279 } 2280 2281 for (i = 0; i < config._f.length; i++) { 2282 currentScore = 0; 2283 tempConfig = copyConfig({}, config); 2284 if (config._useUTC != null) { 2285 tempConfig._useUTC = config._useUTC; 2286 } 2287 tempConfig._f = config._f[i]; 2288 configFromStringAndFormat(tempConfig); 2289 2290 if (!valid__isValid(tempConfig)) { 2291 continue; 2292 } 2293 2294 // if there is any input that was not parsed add a penalty for that format 2295 currentScore += getParsingFlags(tempConfig).charsLeftOver; 2296 2297 //or tokens 2298 currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; 2299 2300 getParsingFlags(tempConfig).score = currentScore; 2301 2302 if (scoreToBeat == null || currentScore < scoreToBeat) { 2303 scoreToBeat = currentScore; 2304 bestMoment = tempConfig; 2305 } 2306 } 2307 2308 extend(config, bestMoment || tempConfig); 2309 } 2310 2311 function configFromObject(config) { 2312 if (config._d) { 2313 return; 2314 } 2315 2316 var i = normalizeObjectUnits(config._i); 2317 config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) { 2318 return obj && parseInt(obj, 10); 2319 }); 2320 2321 configFromArray(config); 2322 } 2323 2324 function createFromConfig (config) { 2325 var res = new Moment(checkOverflow(prepareConfig(config))); 2326 if (res._nextDay) { 2327 // Adding is smart enough around DST 2328 res.add(1, 'd'); 2329 res._nextDay = undefined; 2330 } 2331 2332 return res; 2333 } 2334 2335 function prepareConfig (config) { 2336 var input = config._i, 2337 format = config._f; 2338 2339 config._locale = config._locale || locale_locales__getLocale(config._l); 2340 2341 if (input === null || (format === undefined && input === '')) { 2342 return valid__createInvalid({nullInput: true}); 2343 } 2344 2345 if (typeof input === 'string') { 2346 config._i = input = config._locale.preparse(input); 2347 } 2348 2349 if (isMoment(input)) { 2350 return new Moment(checkOverflow(input)); 2351 } else if (isArray(format)) { 2352 configFromStringAndArray(config); 2353 } else if (isDate(input)) { 2354 config._d = input; 2355 } else if (format) { 2356 configFromStringAndFormat(config); 2357 } else { 2358 configFromInput(config); 2359 } 2360 2361 if (!valid__isValid(config)) { 2362 config._d = null; 2363 } 2364 2365 return config; 2366 } 2367 2368 function configFromInput(config) { 2369 var input = config._i; 2370 if (input === undefined) { 2371 config._d = new Date(utils_hooks__hooks.now()); 2372 } else if (isDate(input)) { 2373 config._d = new Date(input.valueOf()); 2374 } else if (typeof input === 'string') { 2375 configFromString(config); 2376 } else if (isArray(input)) { 2377 config._a = map(input.slice(0), function (obj) { 2378 return parseInt(obj, 10); 2379 }); 2380 configFromArray(config); 2381 } else if (typeof(input) === 'object') { 2382 configFromObject(config); 2383 } else if (typeof(input) === 'number') { 2384 // from milliseconds 2385 config._d = new Date(input); 2386 } else { 2387 utils_hooks__hooks.createFromInputFallback(config); 2388 } 2389 } 2390 2391 function createLocalOrUTC (input, format, locale, strict, isUTC) { 2392 var c = {}; 2393 2394 if (typeof(locale) === 'boolean') { 2395 strict = locale; 2396 locale = undefined; 2397 } 2398 2399 if ((isObject(input) && isObjectEmpty(input)) || 2400 (isArray(input) && input.length === 0)) { 2401 input = undefined; 2402 } 2403 // object construction must be done this way. 2404 // https://github.com/moment/moment/issues/1423 2405 c._isAMomentObject = true; 2406 c._useUTC = c._isUTC = isUTC; 2407 c._l = locale; 2408 c._i = input; 2409 c._f = format; 2410 c._strict = strict; 2411 2412 return createFromConfig(c); 2413 } 2414 2415 function local__createLocal (input, format, locale, strict) { 2416 return createLocalOrUTC(input, format, locale, strict, false); 2417 } 2418 2419 var prototypeMin = deprecate( 2420 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/', 2421 function () { 2422 var other = local__createLocal.apply(null, arguments); 2423 if (this.isValid() && other.isValid()) { 2424 return other < this ? this : other; 2425 } else { 2426 return valid__createInvalid(); 2427 } 2428 } 2429 ); 2430 2431 var prototypeMax = deprecate( 2432 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/', 2433 function () { 2434 var other = local__createLocal.apply(null, arguments); 2435 if (this.isValid() && other.isValid()) { 2436 return other > this ? this : other; 2437 } else { 2438 return valid__createInvalid(); 2439 } 2440 } 2441 ); 2442 2443 // Pick a moment m from moments so that m[fn](other) is true for all 2444 // other. This relies on the function fn to be transitive. 2445 // 2446 // moments should either be an array of moment objects or an array, whose 2447 // first element is an array of moment objects. 2448 function pickBy(fn, moments) { 2449 var res, i; 2450 if (moments.length === 1 && isArray(moments[0])) { 2451 moments = moments[0]; 2452 } 2453 if (!moments.length) { 2454 return local__createLocal(); 2455 } 2456 res = moments[0]; 2457 for (i = 1; i < moments.length; ++i) { 2458 if (!moments[i].isValid() || moments[i][fn](res)) { 2459 res = moments[i]; 2460 } 2461 } 2462 return res; 2463 } 2464 2465 // TODO: Use [].sort instead? 2466 function min () { 2467 var args = [].slice.call(arguments, 0); 2468 2469 return pickBy('isBefore', args); 2470 } 2471 2472 function max () { 2473 var args = [].slice.call(arguments, 0); 2474 2475 return pickBy('isAfter', args); 2476 } 2477 2478 var now = function () { 2479 return Date.now ? Date.now() : +(new Date()); 2480 }; 2481 2482 function Duration (duration) { 2483 var normalizedInput = normalizeObjectUnits(duration), 2484 years = normalizedInput.year || 0, 2485 quarters = normalizedInput.quarter || 0, 2486 months = normalizedInput.month || 0, 2487 weeks = normalizedInput.week || 0, 2488 days = normalizedInput.day || 0, 2489 hours = normalizedInput.hour || 0, 2490 minutes = normalizedInput.minute || 0, 2491 seconds = normalizedInput.second || 0, 2492 milliseconds = normalizedInput.millisecond || 0; 2493 2494 // representation for dateAddRemove 2495 this._milliseconds = +milliseconds + 2496 seconds * 1e3 + // 1000 2497 minutes * 6e4 + // 1000 * 60 2498 hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978 2499 // Because of dateAddRemove treats 24 hours as different from a 2500 // day when working around DST, we need to store them separately 2501 this._days = +days + 2502 weeks * 7; 2503 // It is impossible translate months into days without knowing 2504 // which months you are are talking about, so we have to store 2505 // it separately. 2506 this._months = +months + 2507 quarters * 3 + 2508 years * 12; 2509 2510 this._data = {}; 2511 2512 this._locale = locale_locales__getLocale(); 2513 2514 this._bubble(); 2515 } 2516 2517 function isDuration (obj) { 2518 return obj instanceof Duration; 2519 } 2520 2521 // FORMATTING 2522 2523 function offset (token, separator) { 2524 addFormatToken(token, 0, 0, function () { 2525 var offset = this.utcOffset(); 2526 var sign = '+'; 2527 if (offset < 0) { 2528 offset = -offset; 2529 sign = '-'; 2530 } 2531 return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2); 2532 }); 2533 } 2534 2535 offset('Z', ':'); 2536 offset('ZZ', ''); 2537 2538 // PARSING 2539 2540 addRegexToken('Z', matchShortOffset); 2541 addRegexToken('ZZ', matchShortOffset); 2542 addParseToken(['Z', 'ZZ'], function (input, array, config) { 2543 config._useUTC = true; 2544 config._tzm = offsetFromString(matchShortOffset, input); 2545 }); 2546 2547 // HELPERS 2548 2549 // timezone chunker 2550 // '+10:00' > ['10', '00'] 2551 // '-1530' > ['-15', '30'] 2552 var chunkOffset = /([\+\-]|\d\d)/gi; 2553 2554 function offsetFromString(matcher, string) { 2555 var matches = ((string || '').match(matcher) || []); 2556 var chunk = matches[matches.length - 1] || []; 2557 var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0]; 2558 var minutes = +(parts[1] * 60) + toInt(parts[2]); 2559 2560 return parts[0] === '+' ? minutes : -minutes; 2561 } 2562 2563 // Return a moment from input, that is local/utc/zone equivalent to model. 2564 function cloneWithOffset(input, model) { 2565 var res, diff; 2566 if (model._isUTC) { 2567 res = model.clone(); 2568 diff = (isMoment(input) || isDate(input) ? input.valueOf() : local__createLocal(input).valueOf()) - res.valueOf(); 2569 // Use low-level api, because this fn is low-level api. 2570 res._d.setTime(res._d.valueOf() + diff); 2571 utils_hooks__hooks.updateOffset(res, false); 2572 return res; 2573 } else { 2574 return local__createLocal(input).local(); 2575 } 2576 } 2577 2578 function getDateOffset (m) { 2579 // On Firefox.24 Date#getTimezoneOffset returns a floating point. 2580 // https://github.com/moment/moment/pull/1871 2581 return -Math.round(m._d.getTimezoneOffset() / 15) * 15; 2582 } 2583 2584 // HOOKS 2585 2586 // This function will be called whenever a moment is mutated. 2587 // It is intended to keep the offset in sync with the timezone. 2588 utils_hooks__hooks.updateOffset = function () {}; 2589 2590 // MOMENTS 2591 2592 // keepLocalTime = true means only change the timezone, without 2593 // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]--> 2594 // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset 2595 // +0200, so we adjust the time as needed, to be valid. 2596 // 2597 // Keeping the time actually adds/subtracts (one hour) 2598 // from the actual represented time. That is why we call updateOffset 2599 // a second time. In case it wants us to change the offset again 2600 // _changeInProgress == true case, then we have to adjust, because 2601 // there is no such time in the given timezone. 2602 function getSetOffset (input, keepLocalTime) { 2603 var offset = this._offset || 0, 2604 localAdjust; 2605 if (!this.isValid()) { 2606 return input != null ? this : NaN; 2607 } 2608 if (input != null) { 2609 if (typeof input === 'string') { 2610 input = offsetFromString(matchShortOffset, input); 2611 } else if (Math.abs(input) < 16) { 2612 input = input * 60; 2613 } 2614 if (!this._isUTC && keepLocalTime) { 2615 localAdjust = getDateOffset(this); 2616 } 2617 this._offset = input; 2618 this._isUTC = true; 2619 if (localAdjust != null) { 2620 this.add(localAdjust, 'm'); 2621 } 2622 if (offset !== input) { 2623 if (!keepLocalTime || this._changeInProgress) { 2624 add_subtract__addSubtract(this, create__createDuration(input - offset, 'm'), 1, false); 2625 } else if (!this._changeInProgress) { 2626 this._changeInProgress = true; 2627 utils_hooks__hooks.updateOffset(this, true); 2628 this._changeInProgress = null; 2629 } 2630 } 2631 return this; 2632 } else { 2633 return this._isUTC ? offset : getDateOffset(this); 2634 } 2635 } 2636 2637 function getSetZone (input, keepLocalTime) { 2638 if (input != null) { 2639 if (typeof input !== 'string') { 2640 input = -input; 2641 } 2642 2643 this.utcOffset(input, keepLocalTime); 2644 2645 return this; 2646 } else { 2647 return -this.utcOffset(); 2648 } 2649 } 2650 2651 function setOffsetToUTC (keepLocalTime) { 2652 return this.utcOffset(0, keepLocalTime); 2653 } 2654 2655 function setOffsetToLocal (keepLocalTime) { 2656 if (this._isUTC) { 2657 this.utcOffset(0, keepLocalTime); 2658 this._isUTC = false; 2659 2660 if (keepLocalTime) { 2661 this.subtract(getDateOffset(this), 'm'); 2662 } 2663 } 2664 return this; 2665 } 2666 2667 function setOffsetToParsedOffset () { 2668 if (this._tzm) { 2669 this.utcOffset(this._tzm); 2670 } else if (typeof this._i === 'string') { 2671 this.utcOffset(offsetFromString(matchOffset, this._i)); 2672 } 2673 return this; 2674 } 2675 2676 function hasAlignedHourOffset (input) { 2677 if (!this.isValid()) { 2678 return false; 2679 } 2680 input = input ? local__createLocal(input).utcOffset() : 0; 2681 2682 return (this.utcOffset() - input) % 60 === 0; 2683 } 2684 2685 function isDaylightSavingTime () { 2686 return ( 2687 this.utcOffset() > this.clone().month(0).utcOffset() || 2688 this.utcOffset() > this.clone().month(5).utcOffset() 2689 ); 2690 } 2691 2692 function isDaylightSavingTimeShifted () { 2693 if (!isUndefined(this._isDSTShifted)) { 2694 return this._isDSTShifted; 2695 } 2696 2697 var c = {}; 2698 2699 copyConfig(c, this); 2700 c = prepareConfig(c); 2701 2702 if (c._a) { 2703 var other = c._isUTC ? create_utc__createUTC(c._a) : local__createLocal(c._a); 2704 this._isDSTShifted = this.isValid() && 2705 compareArrays(c._a, other.toArray()) > 0; 2706 } else { 2707 this._isDSTShifted = false; 2708 } 2709 2710 return this._isDSTShifted; 2711 } 2712 2713 function isLocal () { 2714 return this.isValid() ? !this._isUTC : false; 2715 } 2716 2717 function isUtcOffset () { 2718 return this.isValid() ? this._isUTC : false; 2719 } 2720 2721 function isUtc () { 2722 return this.isValid() ? this._isUTC && this._offset === 0 : false; 2723 } 2724 2725 // ASP.NET json date format regex 2726 var aspNetRegex = /^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?\d*)?$/; 2727 2728 // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html 2729 // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere 2730 // and further modified to allow for strings containing both week and day 2731 var isoRegex = /^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/; 2732 2733 function create__createDuration (input, key) { 2734 var duration = input, 2735 // matching against regexp is expensive, do it on demand 2736 match = null, 2737 sign, 2738 ret, 2739 diffRes; 2740 2741 if (isDuration(input)) { 2742 duration = { 2743 ms : input._milliseconds, 2744 d : input._days, 2745 M : input._months 2746 }; 2747 } else if (typeof input === 'number') { 2748 duration = {}; 2749 if (key) { 2750 duration[key] = input; 2751 } else { 2752 duration.milliseconds = input; 2753 } 2754 } else if (!!(match = aspNetRegex.exec(input))) { 2755 sign = (match[1] === '-') ? -1 : 1; 2756 duration = { 2757 y : 0, 2758 d : toInt(match[DATE]) * sign, 2759 h : toInt(match[HOUR]) * sign, 2760 m : toInt(match[MINUTE]) * sign, 2761 s : toInt(match[SECOND]) * sign, 2762 ms : toInt(match[MILLISECOND]) * sign 2763 }; 2764 } else if (!!(match = isoRegex.exec(input))) { 2765 sign = (match[1] === '-') ? -1 : 1; 2766 duration = { 2767 y : parseIso(match[2], sign), 2768 M : parseIso(match[3], sign), 2769 w : parseIso(match[4], sign), 2770 d : parseIso(match[5], sign), 2771 h : parseIso(match[6], sign), 2772 m : parseIso(match[7], sign), 2773 s : parseIso(match[8], sign) 2774 }; 2775 } else if (duration == null) {// checks for null or undefined 2776 duration = {}; 2777 } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) { 2778 diffRes = momentsDifference(local__createLocal(duration.from), local__createLocal(duration.to)); 2779 2780 duration = {}; 2781 duration.ms = diffRes.milliseconds; 2782 duration.M = diffRes.months; 2783 } 2784 2785 ret = new Duration(duration); 2786 2787 if (isDuration(input) && hasOwnProp(input, '_locale')) { 2788 ret._locale = input._locale; 2789 } 2790 2791 return ret; 2792 } 2793 2794 create__createDuration.fn = Duration.prototype; 2795 2796 function parseIso (inp, sign) { 2797 // We'd normally use ~~inp for this, but unfortunately it also 2798 // converts floats to ints. 2799 // inp may be undefined, so careful calling replace on it. 2800 var res = inp && parseFloat(inp.replace(',', '.')); 2801 // apply sign while we're at it 2802 return (isNaN(res) ? 0 : res) * sign; 2803 } 2804 2805 function positiveMomentsDifference(base, other) { 2806 var res = {milliseconds: 0, months: 0}; 2807 2808 res.months = other.month() - base.month() + 2809 (other.year() - base.year()) * 12; 2810 if (base.clone().add(res.months, 'M').isAfter(other)) { 2811 --res.months; 2812 } 2813 2814 res.milliseconds = +other - +(base.clone().add(res.months, 'M')); 2815 2816 return res; 2817 } 2818 2819 function momentsDifference(base, other) { 2820 var res; 2821 if (!(base.isValid() && other.isValid())) { 2822 return {milliseconds: 0, months: 0}; 2823 } 2824 2825 other = cloneWithOffset(other, base); 2826 if (base.isBefore(other)) { 2827 res = positiveMomentsDifference(base, other); 2828 } else { 2829 res = positiveMomentsDifference(other, base); 2830 res.milliseconds = -res.milliseconds; 2831 res.months = -res.months; 2832 } 2833 2834 return res; 2835 } 2836 2837 function absRound (number) { 2838 if (number < 0) { 2839 return Math.round(-1 * number) * -1; 2840 } else { 2841 return Math.round(number); 2842 } 2843 } 2844 2845 // TODO: remove 'name' arg after deprecation is removed 2846 function createAdder(direction, name) { 2847 return function (val, period) { 2848 var dur, tmp; 2849 //invert the arguments, but complain about it 2850 if (period !== null && !isNaN(+period)) { 2851 deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' + 2852 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'); 2853 tmp = val; val = period; period = tmp; 2854 } 2855 2856 val = typeof val === 'string' ? +val : val; 2857 dur = create__createDuration(val, period); 2858 add_subtract__addSubtract(this, dur, direction); 2859 return this; 2860 }; 2861 } 2862 2863 function add_subtract__addSubtract (mom, duration, isAdding, updateOffset) { 2864 var milliseconds = duration._milliseconds, 2865 days = absRound(duration._days), 2866 months = absRound(duration._months); 2867 2868 if (!mom.isValid()) { 2869 // No op 2870 return; 2871 } 2872 2873 updateOffset = updateOffset == null ? true : updateOffset; 2874 2875 if (milliseconds) { 2876 mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); 2877 } 2878 if (days) { 2879 get_set__set(mom, 'Date', get_set__get(mom, 'Date') + days * isAdding); 2880 } 2881 if (months) { 2882 setMonth(mom, get_set__get(mom, 'Month') + months * isAdding); 2883 } 2884 if (updateOffset) { 2885 utils_hooks__hooks.updateOffset(mom, days || months); 2886 } 2887 } 2888 2889 var add_subtract__add = createAdder(1, 'add'); 2890 var add_subtract__subtract = createAdder(-1, 'subtract'); 2891 2892 function getCalendarFormat(myMoment, now) { 2893 var diff = myMoment.diff(now, 'days', true); 2894 return diff < -6 ? 'sameElse' : 2895 diff < -1 ? 'lastWeek' : 2896 diff < 0 ? 'lastDay' : 2897 diff < 1 ? 'sameDay' : 2898 diff < 2 ? 'nextDay' : 2899 diff < 7 ? 'nextWeek' : 'sameElse'; 2900 } 2901 2902 function moment_calendar__calendar (time, formats) { 2903 // We want to compare the start of today, vs this. 2904 // Getting start-of-today depends on whether we're local/utc/offset or not. 2905 var now = time || local__createLocal(), 2906 sod = cloneWithOffset(now, this).startOf('day'), 2907 format = utils_hooks__hooks.calendarFormat(this, sod) || 'sameElse'; 2908 2909 var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]); 2910
2911 return this.format(output || this.localeData().calendar(format, this, local__createLocal(now))); 2912 } 2913 2914 function clone () { 2915 return new Moment(this); 2916 } 2917 2918 function isAfter (input, units) { 2919 var localInput = isMoment(input) ? input : local__createLocal(input); 2920 if (!(this.isValid() && localInput.isValid())) { 2921 return false; 2922 } 2923 units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); 2924 if (units === 'millisecond') { 2925 return this.valueOf() > localInput.valueOf(); 2926 } else { 2927 return localInput.valueOf() < this.clone().startOf(units).valueOf(); 2928 } 2929 } 2930 2931 function isBefore (input, units) { 2932 var localInput = isMoment(input) ? input : local__createLocal(input); 2933 if (!(this.isValid() && localInput.isValid())) { 2934 return false; 2935 } 2936 units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); 2937 if (units === 'millisecond') { 2938 return this.valueOf() < localInput.valueOf(); 2939 } else { 2940 return this.clone().endOf(units).valueOf() < localInput.valueOf(); 2941 } 2942 } 2943 2944 function isBetween (from, to, units, inclusivity) { 2945 inclusivity = inclusivity || '()'; 2946 return (inclusivity[0] === '(' ? this.isAfter(from, units) : !this.isBefore(from, units)) && 2947 (inclusivity[1] === ')' ? this.isBefore(to, units) : !this.isAfter(to, units)); 2948 } 2949 2950 function isSame (input, units) { 2951 var localInput = isMoment(input) ? input : local__createLocal(input), 2952 inputMs; 2953 if (!(this.isValid() && localInput.isValid())) { 2954 return false; 2955 } 2956 units = normalizeUnits(units || 'millisecond'); 2957 if (units === 'millisecond') { 2958 return this.valueOf() === localInput.valueOf(); 2959 } else { 2960 inputMs = localInput.valueOf(); 2961 return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf(); 2962 } 2963 } 2964 2965 function isSameOrAfter (input, units) { 2966 return this.isSame(input, units) || this.isAfter(input,units); 2967 } 2968 2969 function isSameOrBefore (input, units) { 2970 return this.isSame(input, units) || this.isBefore(input,units); 2971 } 2972 2973 function diff (input, units, asFloat) { 2974 var that, 2975 zoneDelta, 2976 delta, output; 2977 2978 if (!this.isValid()) { 2979 return NaN; 2980 } 2981 2982 that = cloneWithOffset(input, this); 2983 2984 if (!that.isValid()) { 2985 return NaN; 2986 } 2987 2988 zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; 2989 2990 units = normalizeUnits(units); 2991 2992 if (units === 'year' || units === 'month' || units === 'quarter') { 2993 output = monthDiff(this, that); 2994 if (units === 'quarter') { 2995 output = output / 3; 2996 } else if (units === 'year') { 2997 output = output / 12; 2998 } 2999 } else { 3000 delta = this - that; 3001 output = units === 'second' ? delta / 1e3 : // 1000 3002 units === 'minute' ? delta / 6e4 : // 1000 * 60 3003 units === 'hour' ? delta / 36e5 : // 1000 * 60 * 60 3004 units === 'day' ? (delta - zoneDelta) / 864e5 : // 1000 * 60 * 60 * 24, negate dst 3005 units === 'week' ? (delta - zoneDelta) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst 3006 delta; 3007 } 3008 return asFloat ? output : absFloor(output); 3009 } 3010 3011 function monthDiff (a, b) { 3012 // difference in months 3013 var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()), 3014 // b is in (anchor - 1 month, anchor + 1 month) 3015 anchor = a.clone().add(wholeMonthDiff, 'months'), 3016 anchor2, adjust; 3017 3018 if (b - anchor < 0) { 3019 anchor2 = a.clone().add(wholeMonthDiff - 1, 'months'); 3020 // linear across the month 3021 adjust = (b - anchor) / (anchor - anchor2); 3022 } else { 3023 anchor2 = a.clone().add(wholeMonthDiff + 1, 'months'); 3024 // linear across the month 3025 adjust = (b - anchor) / (anchor2 - anchor); 3026 } 3027 3028 //check for negative zero, return zero if negative zero 3029 return -(wholeMonthDiff + adjust) || 0; 3030 } 3031 3032 utils_hooks__hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ'; 3033 utils_hooks__hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]'; 3034 3035 function toString () { 3036 return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'); 3037 } 3038 3039 function moment_format__toISOString () { 3040 var m = this.clone().utc(); 3041 if (0 < m.year() && m.year() <= 9999) { 3042 if (isFunction(Date.prototype.toISOString)) { 3043 // native implementation is ~50x faster, use it when we can 3044 return this.toDate().toISOString(); 3045 } else { 3046 return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); 3047 } 3048 } else { 3049 return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); 3050 } 3051 } 3052 3053 function format (inputString) { 3054 if (!inputString) { 3055 inputString = this.isUtc() ? utils_hooks__hooks.defaultFormatUtc : utils_hooks__hooks.defaultFormat; 3056 } 3057 var output = formatMoment(this, inputString);
3058 return this.localeData().postformat(output); 3059 } 3060 3061 function from (time, withoutSuffix) { 3062 if (this.isValid() && 3063 ((isMoment(time) && time.isValid()) || 3064 local__createLocal(time).isValid())) { 3065 return create__createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix); 3066 } else { 3067 return this.localeData().invalidDate(); 3068 } 3069 } 3070 3071 function fromNow (withoutSuffix) { 3072 return this.from(local__createLocal(), withoutSuffix); 3073 } 3074 3075 function to (time, withoutSuffix) { 3076 if (this.isValid() && 3077 ((isMoment(time) && time.isValid()) || 3078 local__createLocal(time).isValid())) { 3079 return create__createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix); 3080 } else { 3081 return this.localeData().invalidDate(); 3082 } 3083 } 3084 3085 function toNow (withoutSuffix) { 3086 return this.to(local__createLocal(), withoutSuffix); 3087 } 3088 3089 // If passed a locale key, it will set the locale for this 3090 // instance. Otherwise, it will return the locale configuration 3091 // variables for this instance. 3092 function locale (key) { 3093 var newLocaleData; 3094 3095 if (key === undefined) { 3096 return this._locale._abbr; 3097 } else { 3098 newLocaleData = locale_locales__getLocale(key); 3099 if (newLocaleData != null) { 3100 this._locale = newLocaleData; 3101 } 3102 return this; 3103 } 3104 } 3105 3106 var lang = deprecate( 3107 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', 3108 function (key) { 3109 if (key === undefined) { 3110 return this.localeData(); 3111 } else { 3112 return this.locale(key); 3113 } 3114 } 3115 ); 3116 3117 function localeData () { 3118 return this._locale; 3119 } 3120 3121 function startOf (units) { 3122 units = normalizeUnits(units); 3123 // the following switch intentionally omits break keywords 3124 // to utilize falling through the cases. 3125 switch (units) { 3126 case 'year': 3127 this.month(0); 3128 /* falls through */ 3129 case 'quarter': 3130 case 'month': 3131 this.date(1); 3132 /* falls through */ 3133 case 'week': 3134 case 'isoWeek': 3135 case 'day': 3136 case 'date': 3137 this.hours(0); 3138 /* falls through */ 3139 case 'hour': 3140 this.minutes(0); 3141 /* falls through */ 3142 case 'minute': 3143 this.seconds(0); 3144 /* falls through */ 3145 case 'second': 3146 this.milliseconds(0); 3147 } 3148 3149 // weeks are a special case 3150 if (units === 'week') { 3151 this.weekday(0); 3152 } 3153 if (units === 'isoWeek') { 3154 this.isoWeekday(1); 3155 } 3156 3157 // quarters are also special 3158 if (units === 'quarter') { 3159 this.month(Math.floor(this.month() / 3) * 3); 3160 } 3161 3162 return this; 3163 } 3164 3165 function endOf (units) { 3166 units = normalizeUnits(units); 3167 if (units === undefined || units === 'millisecond') { 3168 return this; 3169 } 3170 3171 // 'date' is an alias for 'day', so it should be considered as such. 3172 if (units === 'date') { 3173 units = 'day'; 3174 } 3175 3176 return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms'); 3177 } 3178 3179 function to_type__valueOf () { 3180 return this._d.valueOf() - ((this._offset || 0) * 60000); 3181 } 3182 3183 function unix () { 3184 return Math.floor(this.valueOf() / 1000); 3185 } 3186 3187 function toDate () { 3188 return new Date(this.valueOf()); 3189 } 3190 3191 function toArray () { 3192 var m = this; 3193 return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()]; 3194 } 3195 3196 function toObject () { 3197 var m = this; 3198 return { 3199 years: m.year(), 3200 months: m.month(), 3201 date: m.date(), 3202 hours: m.hours(), 3203 minutes: m.minutes(), 3204 seconds: m.seconds(), 3205 milliseconds: m.milliseconds() 3206 }; 3207 } 3208 3209 function toJSON () { 3210 // new Date(NaN).toJSON() === null 3211 return this.isValid() ? this.toISOString() : null; 3212 } 3213 3214 function moment_valid__isValid () { 3215 return valid__isValid(this); 3216 } 3217 3218 function parsingFlags () { 3219 return extend({}, getParsingFlags(this)); 3220 } 3221
vendor: 33,140 bytes, lines 3222-4195
3222 function invalidAt () { 3223 return getParsingFlags(this).overflow; 3224 } 3225 3226 function creationData() { 3227 return { 3228 input: this._i, 3229 format: this._f, 3230 locale: this._locale, 3231 isUTC: this._isUTC, 3232 strict: this._strict 3233 }; 3234 } 3235 3236 // FORMATTING 3237 3238 addFormatToken(0, ['gg', 2], 0, function () { 3239 return this.weekYear() % 100; 3240 }); 3241 3242 addFormatToken(0, ['GG', 2], 0, function () { 3243 return this.isoWeekYear() % 100; 3244 }); 3245 3246 function addWeekYearFormatToken (token, getter) { 3247 addFormatToken(0, [token, token.length], 0, getter); 3248 } 3249 3250 addWeekYearFormatToken('gggg', 'weekYear'); 3251 addWeekYearFormatToken('ggggg', 'weekYear'); 3252 addWeekYearFormatToken('GGGG', 'isoWeekYear'); 3253 addWeekYearFormatToken('GGGGG', 'isoWeekYear'); 3254 3255 // ALIASES 3256 3257 addUnitAlias('weekYear', 'gg'); 3258 addUnitAlias('isoWeekYear', 'GG'); 3259 3260 // PRIORITY 3261 3262 addUnitPriority('weekYear', 1); 3263 addUnitPriority('isoWeekYear', 1); 3264 3265 3266 // PARSING 3267 3268 addRegexToken('G', matchSigned); 3269 addRegexToken('g', matchSigned); 3270 addRegexToken('GG', match1to2, match2); 3271 addRegexToken('gg', match1to2, match2); 3272 addRegexToken('GGGG', match1to4, match4); 3273 addRegexToken('gggg', match1to4, match4); 3274 addRegexToken('GGGGG', match1to6, match6); 3275 addRegexToken('ggggg', match1to6, match6); 3276 3277 addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) { 3278 week[token.substr(0, 2)] = toInt(input); 3279 }); 3280 3281 addWeekParseToken(['gg', 'GG'], function (input, week, config, token) { 3282 week[token] = utils_hooks__hooks.parseTwoDigitYear(input); 3283 }); 3284 3285 // MOMENTS 3286 3287 function getSetWeekYear (input) { 3288 return getSetWeekYearHelper.call(this, 3289 input, 3290 this.week(), 3291 this.weekday(), 3292 this.localeData()._week.dow, 3293 this.localeData()._week.doy); 3294 } 3295 3296 function getSetISOWeekYear (input) { 3297 return getSetWeekYearHelper.call(this, 3298 input, this.isoWeek(), this.isoWeekday(), 1, 4); 3299 } 3300 3301 function getISOWeeksInYear () { 3302 return weeksInYear(this.year(), 1, 4); 3303 } 3304 3305 function getWeeksInYear () { 3306 var weekInfo = this.localeData()._week; 3307 return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); 3308 } 3309 3310 function getSetWeekYearHelper(input, week, weekday, dow, doy) { 3311 var weeksTarget; 3312 if (input == null) { 3313 return weekOfYear(this, dow, doy).year; 3314 } else { 3315 weeksTarget = weeksInYear(input, dow, doy); 3316 if (week > weeksTarget) { 3317 week = weeksTarget; 3318 } 3319 return setWeekAll.call(this, input, week, weekday, dow, doy); 3320 } 3321 } 3322 3323 function setWeekAll(weekYear, week, weekday, dow, doy) { 3324 var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), 3325 date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear); 3326 3327 this.year(date.getUTCFullYear()); 3328 this.month(date.getUTCMonth()); 3329 this.date(date.getUTCDate()); 3330 return this; 3331 } 3332 3333 // FORMATTING 3334 3335 addFormatToken('Q', 0, 'Qo', 'quarter'); 3336 3337 // ALIASES 3338 3339 addUnitAlias('quarter', 'Q'); 3340 3341 // PRIORITY 3342 3343 addUnitPriority('quarter', 7); 3344 3345 // PARSING 3346 3347 addRegexToken('Q', match1); 3348 addParseToken('Q', function (input, array) { 3349 array[MONTH] = (toInt(input) - 1) * 3; 3350 }); 3351 3352 // MOMENTS 3353 3354 function getSetQuarter (input) { 3355 return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3); 3356 } 3357 3358 // FORMATTING 3359 3360 addFormatToken('D', ['DD', 2], 'Do', 'date'); 3361 3362 // ALIASES 3363 3364 addUnitAlias('date', 'D'); 3365 3366 // PRIOROITY 3367 addUnitPriority('date', 9); 3368 3369 // PARSING 3370 3371 addRegexToken('D', match1to2); 3372 addRegexToken('DD', match1to2, match2); 3373 addRegexToken('Do', function (isStrict, locale) { 3374 return isStrict ? locale._ordinalParse : locale._ordinalParseLenient; 3375 }); 3376 3377 addParseToken(['D', 'DD'], DATE); 3378 addParseToken('Do', function (input, array) { 3379 array[DATE] = toInt(input.match(match1to2)[0], 10); 3380 }); 3381 3382 // MOMENTS 3383 3384 var getSetDayOfMonth = makeGetSet('Date', true); 3385 3386 // FORMATTING 3387 3388 addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear'); 3389 3390 // ALIASES 3391 3392 addUnitAlias('dayOfYear', 'DDD'); 3393 3394 // PRIORITY 3395 addUnitPriority('dayOfYear', 4); 3396 3397 // PARSING 3398 3399 addRegexToken('DDD', match1to3); 3400 addRegexToken('DDDD', match3); 3401 addParseToken(['DDD', 'DDDD'], function (input, array, config) { 3402 config._dayOfYear = toInt(input); 3403 }); 3404 3405 // HELPERS 3406 3407 // MOMENTS 3408 3409 function getSetDayOfYear (input) { 3410 var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1; 3411 return input == null ? dayOfYear : this.add((input - dayOfYear), 'd'); 3412 } 3413 3414 // FORMATTING 3415 3416 addFormatToken('m', ['mm', 2], 0, 'minute'); 3417 3418 // ALIASES 3419 3420 addUnitAlias('minute', 'm'); 3421 3422 // PRIORITY 3423 3424 addUnitPriority('minute', 14); 3425 3426 // PARSING 3427 3428 addRegexToken('m', match1to2); 3429 addRegexToken('mm', match1to2, match2); 3430 addParseToken(['m', 'mm'], MINUTE); 3431 3432 // MOMENTS 3433 3434 var getSetMinute = makeGetSet('Minutes', false); 3435 3436 // FORMATTING 3437 3438 addFormatToken('s', ['ss', 2], 0, 'second'); 3439 3440 // ALIASES 3441 3442 addUnitAlias('second', 's'); 3443 3444 // PRIORITY 3445 3446 addUnitPriority('second', 15); 3447 3448 // PARSING 3449 3450 addRegexToken('s', match1to2); 3451 addRegexToken('ss', match1to2, match2); 3452 addParseToken(['s', 'ss'], SECOND); 3453 3454 // MOMENTS 3455 3456 var getSetSecond = makeGetSet('Seconds', false); 3457 3458 // FORMATTING 3459 3460 addFormatToken('S', 0, 0, function () { 3461 return ~~(this.millisecond() / 100); 3462 }); 3463 3464 addFormatToken(0, ['SS', 2], 0, function () { 3465 return ~~(this.millisecond() / 10); 3466 }); 3467 3468 addFormatToken(0, ['SSS', 3], 0, 'millisecond'); 3469 addFormatToken(0, ['SSSS', 4], 0, function () { 3470 return this.millisecond() * 10; 3471 }); 3472 addFormatToken(0, ['SSSSS', 5], 0, function () { 3473 return this.millisecond() * 100; 3474 }); 3475 addFormatToken(0, ['SSSSSS', 6], 0, function () { 3476 return this.millisecond() * 1000; 3477 }); 3478 addFormatToken(0, ['SSSSSSS', 7], 0, function () { 3479 return this.millisecond() * 10000; 3480 }); 3481 addFormatToken(0, ['SSSSSSSS', 8], 0, function () { 3482 return this.millisecond() * 100000; 3483 }); 3484 addFormatToken(0, ['SSSSSSSSS', 9], 0, function () { 3485 return this.millisecond() * 1000000; 3486 }); 3487 3488 3489 // ALIASES 3490 3491 addUnitAlias('millisecond', 'ms'); 3492 3493 // PRIORITY 3494 3495 addUnitPriority('millisecond', 16); 3496 3497 // PARSING 3498 3499 addRegexToken('S', match1to3, match1); 3500 addRegexToken('SS', match1to3, match2); 3501 addRegexToken('SSS', match1to3, match3); 3502 3503 var token; 3504 for (token = 'SSSS'; token.length <= 9; token += 'S') { 3505 addRegexToken(token, matchUnsigned); 3506 } 3507 3508 function parseMs(input, array) { 3509 array[MILLISECOND] = toInt(('0.' + input) * 1000); 3510 } 3511 3512 for (token = 'S'; token.length <= 9; token += 'S') { 3513 addParseToken(token, parseMs); 3514 } 3515 // MOMENTS 3516 3517 var getSetMillisecond = makeGetSet('Milliseconds', false); 3518 3519 // FORMATTING 3520 3521 addFormatToken('z', 0, 0, 'zoneAbbr'); 3522 addFormatToken('zz', 0, 0, 'zoneName'); 3523 3524 // MOMENTS 3525 3526 function getZoneAbbr () { 3527 return this._isUTC ? 'UTC' : ''; 3528 } 3529 3530 function getZoneName () { 3531 return this._isUTC ? 'Coordinated Universal Time' : ''; 3532 } 3533 3534 var momentPrototype__proto = Moment.prototype; 3535 3536 momentPrototype__proto.add = add_subtract__add; 3537 momentPrototype__proto.calendar = moment_calendar__calendar; 3538 momentPrototype__proto.clone = clone; 3539 momentPrototype__proto.diff = diff; 3540 momentPrototype__proto.endOf = endOf; 3541 momentPrototype__proto.format = format; 3542 momentPrototype__proto.from = from; 3543 momentPrototype__proto.fromNow = fromNow; 3544 momentPrototype__proto.to = to; 3545 momentPrototype__proto.toNow = toNow; 3546 momentPrototype__proto.get = stringGet; 3547 momentPrototype__proto.invalidAt = invalidAt; 3548 momentPrototype__proto.isAfter = isAfter; 3549 momentPrototype__proto.isBefore = isBefore; 3550 momentPrototype__proto.isBetween = isBetween; 3551 momentPrototype__proto.isSame = isSame; 3552 momentPrototype__proto.isSameOrAfter = isSameOrAfter; 3553 momentPrototype__proto.isSameOrBefore = isSameOrBefore; 3554 momentPrototype__proto.isValid = moment_valid__isValid; 3555 momentPrototype__proto.lang = lang; 3556 momentPrototype__proto.locale = locale; 3557 momentPrototype__proto.localeData = localeData; 3558 momentPrototype__proto.max = prototypeMax; 3559 momentPrototype__proto.min = prototypeMin; 3560 momentPrototype__proto.parsingFlags = parsingFlags; 3561 momentPrototype__proto.set = stringSet; 3562 momentPrototype__proto.startOf = startOf; 3563 momentPrototype__proto.subtract = add_subtract__subtract; 3564 momentPrototype__proto.toArray = toArray; 3565 momentPrototype__proto.toObject = toObject; 3566 momentPrototype__proto.toDate = toDate; 3567 momentPrototype__proto.toISOString = moment_format__toISOString; 3568 momentPrototype__proto.toJSON = toJSON; 3569 momentPrototype__proto.toString = toString; 3570 momentPrototype__proto.unix = unix; 3571 momentPrototype__proto.valueOf = to_type__valueOf; 3572 momentPrototype__proto.creationData = creationData; 3573 3574 // Year 3575 momentPrototype__proto.year = getSetYear; 3576 momentPrototype__proto.isLeapYear = getIsLeapYear; 3577 3578 // Week Year 3579 momentPrototype__proto.weekYear = getSetWeekYear; 3580 momentPrototype__proto.isoWeekYear = getSetISOWeekYear; 3581 3582 // Quarter 3583 momentPrototype__proto.quarter = momentPrototype__proto.quarters = getSetQuarter; 3584 3585 // Month 3586 momentPrototype__proto.month = getSetMonth; 3587 momentPrototype__proto.daysInMonth = getDaysInMonth; 3588 3589 // Week 3590 momentPrototype__proto.week = momentPrototype__proto.weeks = getSetWeek; 3591 momentPrototype__proto.isoWeek = momentPrototype__proto.isoWeeks = getSetISOWeek; 3592 momentPrototype__proto.weeksInYear = getWeeksInYear; 3593 momentPrototype__proto.isoWeeksInYear = getISOWeeksInYear; 3594 3595 // Day 3596 momentPrototype__proto.date = getSetDayOfMonth; 3597 momentPrototype__proto.day = momentPrototype__proto.days = getSetDayOfWeek; 3598 momentPrototype__proto.weekday = getSetLocaleDayOfWeek; 3599 momentPrototype__proto.isoWeekday = getSetISODayOfWeek; 3600 momentPrototype__proto.dayOfYear = getSetDayOfYear; 3601 3602 // Hour 3603 momentPrototype__proto.hour = momentPrototype__proto.hours = getSetHour; 3604 3605 // Minute 3606 momentPrototype__proto.minute = momentPrototype__proto.minutes = getSetMinute; 3607 3608 // Second 3609 momentPrototype__proto.second = momentPrototype__proto.seconds = getSetSecond; 3610 3611 // Millisecond 3612 momentPrototype__proto.millisecond = momentPrototype__proto.milliseconds = getSetMillisecond; 3613 3614 // Offset 3615 momentPrototype__proto.utcOffset = getSetOffset; 3616 momentPrototype__proto.utc = setOffsetToUTC; 3617 momentPrototype__proto.local = setOffsetToLocal; 3618 momentPrototype__proto.parseZone = setOffsetToParsedOffset; 3619 momentPrototype__proto.hasAlignedHourOffset = hasAlignedHourOffset; 3620 momentPrototype__proto.isDST = isDaylightSavingTime; 3621 momentPrototype__proto.isLocal = isLocal; 3622 momentPrototype__proto.isUtcOffset = isUtcOffset; 3623 momentPrototype__proto.isUtc = isUtc; 3624 momentPrototype__proto.isUTC = isUtc; 3625 3626 // Timezone 3627 momentPrototype__proto.zoneAbbr = getZoneAbbr; 3628 momentPrototype__proto.zoneName = getZoneName; 3629 3630 // Deprecations 3631 momentPrototype__proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth); 3632 momentPrototype__proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth); 3633 momentPrototype__proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear); 3634 momentPrototype__proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone); 3635 momentPrototype__proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted); 3636 3637 var momentPrototype = momentPrototype__proto; 3638 3639 function moment__createUnix (input) { 3640 return local__createLocal(input * 1000); 3641 } 3642 3643 function moment__createInZone () { 3644 return local__createLocal.apply(null, arguments).parseZone(); 3645 } 3646 3647 function preParsePostFormat (string) { 3648 return string; 3649 } 3650 3651 var prototype__proto = Locale.prototype; 3652 3653 prototype__proto.calendar = locale_calendar__calendar; 3654 prototype__proto.longDateFormat = longDateFormat; 3655 prototype__proto.invalidDate = invalidDate; 3656 prototype__proto.ordinal = ordinal; 3657 prototype__proto.preparse = preParsePostFormat; 3658 prototype__proto.postformat = preParsePostFormat; 3659 prototype__proto.relativeTime = relative__relativeTime; 3660 prototype__proto.pastFuture = pastFuture; 3661 prototype__proto.set = locale_set__set; 3662 3663 // Month 3664 prototype__proto.months = localeMonths; 3665 prototype__proto.monthsShort = localeMonthsShort; 3666 prototype__proto.monthsParse = localeMonthsParse; 3667 prototype__proto.monthsRegex = monthsRegex; 3668 prototype__proto.monthsShortRegex = monthsShortRegex; 3669 3670 // Week 3671 prototype__proto.week = localeWeek; 3672 prototype__proto.firstDayOfYear = localeFirstDayOfYear; 3673 prototype__proto.firstDayOfWeek = localeFirstDayOfWeek; 3674 3675 // Day of Week 3676 prototype__proto.weekdays = localeWeekdays; 3677 prototype__proto.weekdaysMin = localeWeekdaysMin; 3678 prototype__proto.weekdaysShort = localeWeekdaysShort; 3679 prototype__proto.weekdaysParse = localeWeekdaysParse; 3680 3681 prototype__proto.weekdaysRegex = weekdaysRegex; 3682 prototype__proto.weekdaysShortRegex = weekdaysShortRegex; 3683 prototype__proto.weekdaysMinRegex = weekdaysMinRegex; 3684 3685 // Hours 3686 prototype__proto.isPM = localeIsPM; 3687 prototype__proto.meridiem = localeMeridiem; 3688 3689 function lists__get (format, index, field, setter) { 3690 var locale = locale_locales__getLocale(); 3691 var utc = create_utc__createUTC().set(setter, index); 3692 return locale[field](utc, format); 3693 } 3694 3695 function listMonthsImpl (format, index, field) { 3696 if (typeof format === 'number') { 3697 index = format; 3698 format = undefined; 3699 } 3700 3701 format = format || ''; 3702 3703 if (index != null) { 3704 return lists__get(format, index, field, 'month'); 3705 } 3706 3707 var i; 3708 var out = []; 3709 for (i = 0; i < 12; i++) { 3710 out[i] = lists__get(format, i, field, 'month'); 3711 } 3712 return out; 3713 } 3714 3715 // () 3716 // (5) 3717 // (fmt, 5) 3718 // (fmt) 3719 // (true) 3720 // (true, 5) 3721 // (true, fmt, 5) 3722 // (true, fmt) 3723 function listWeekdaysImpl (localeSorted, format, index, field) { 3724 if (typeof localeSorted === 'boolean') { 3725 if (typeof format === 'number') { 3726 index = format; 3727 format = undefined; 3728 } 3729 3730 format = format || ''; 3731 } else { 3732 format = localeSorted; 3733 index = format; 3734 localeSorted = false; 3735 3736 if (typeof format === 'number') { 3737 index = format; 3738 format = undefined; 3739 } 3740 3741 format = format || ''; 3742 } 3743 3744 var locale = locale_locales__getLocale(), 3745 shift = localeSorted ? locale._week.dow : 0; 3746 3747 if (index != null) { 3748 return lists__get(format, (index + shift) % 7, field, 'day'); 3749 } 3750 3751 var i; 3752 var out = []; 3753 for (i = 0; i < 7; i++) { 3754 out[i] = lists__get(format, (i + shift) % 7, field, 'day'); 3755 } 3756 return out; 3757 } 3758 3759 function lists__listMonths (format, index) { 3760 return listMonthsImpl(format, index, 'months'); 3761 } 3762 3763 function lists__listMonthsShort (format, index) { 3764 return listMonthsImpl(format, index, 'monthsShort'); 3765 } 3766 3767 function lists__listWeekdays (localeSorted, format, index) { 3768 return listWeekdaysImpl(localeSorted, format, index, 'weekdays'); 3769 } 3770 3771 function lists__listWeekdaysShort (localeSorted, format, index) { 3772 return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort'); 3773 } 3774 3775 function lists__listWeekdaysMin (localeSorted, format, index) { 3776 return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin'); 3777 } 3778 3779 locale_locales__getSetGlobalLocale('en', { 3780 ordinalParse: /\d{1,2}(th|st|nd|rd)/, 3781 ordinal : function (number) { 3782 var b = number % 10, 3783 output = (toInt(number % 100 / 10) === 1) ? 'th' : 3784 (b === 1) ? 'st' : 3785 (b === 2) ? 'nd' : 3786 (b === 3) ? 'rd' : 'th'; 3787 return number + output; 3788 } 3789 }); 3790 3791 // Side effect imports 3792 utils_hooks__hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', locale_locales__getSetGlobalLocale); 3793 utils_hooks__hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', locale_locales__getLocale); 3794 3795 var mathAbs = Math.abs; 3796 3797 function duration_abs__abs () { 3798 var data = this._data; 3799 3800 this._milliseconds = mathAbs(this._milliseconds); 3801 this._days = mathAbs(this._days); 3802 this._months = mathAbs(this._months); 3803 3804 data.milliseconds = mathAbs(data.milliseconds); 3805 data.seconds = mathAbs(data.seconds); 3806 data.minutes = mathAbs(data.minutes); 3807 data.hours = mathAbs(data.hours); 3808 data.months = mathAbs(data.months); 3809 data.years = mathAbs(data.years); 3810 3811 return this; 3812 } 3813 3814 function duration_add_subtract__addSubtract (duration, input, value, direction) { 3815 var other = create__createDuration(input, value); 3816 3817 duration._milliseconds += direction * other._milliseconds; 3818 duration._days += direction * other._days; 3819 duration._months += direction * other._months; 3820 3821 return duration._bubble(); 3822 } 3823 3824 // supports only 2.0-style add(1, 's') or add(duration) 3825 function duration_add_subtract__add (input, value) { 3826 return duration_add_subtract__addSubtract(this, input, value, 1); 3827 } 3828 3829 // supports only 2.0-style subtract(1, 's') or subtract(duration) 3830 function duration_add_subtract__subtract (input, value) { 3831 return duration_add_subtract__addSubtract(this, input, value, -1); 3832 } 3833 3834 function absCeil (number) { 3835 if (number < 0) { 3836 return Math.floor(number); 3837 } else { 3838 return Math.ceil(number); 3839 } 3840 } 3841 3842 function bubble () { 3843 var milliseconds = this._milliseconds; 3844 var days = this._days; 3845 var months = this._months; 3846 var data = this._data; 3847 var seconds, minutes, hours, years, monthsFromDays; 3848 3849 // if we have a mix of positive and negative values, bubble down first 3850 // check: https://github.com/moment/moment/issues/2166 3851 if (!((milliseconds >= 0 && days >= 0 && months >= 0) || 3852 (milliseconds <= 0 && days <= 0 && months <= 0))) { 3853 milliseconds += absCeil(monthsToDays(months) + days) * 864e5; 3854 days = 0; 3855 months = 0; 3856 } 3857 3858 // The following code bubbles up values, see the tests for 3859 // examples of what that means. 3860 data.milliseconds = milliseconds % 1000; 3861 3862 seconds = absFloor(milliseconds / 1000); 3863 data.seconds = seconds % 60; 3864 3865 minutes = absFloor(seconds / 60); 3866 data.minutes = minutes % 60; 3867 3868 hours = absFloor(minutes / 60); 3869 data.hours = hours % 24; 3870 3871 days += absFloor(hours / 24); 3872 3873 // convert days to months 3874 monthsFromDays = absFloor(daysToMonths(days)); 3875 months += monthsFromDays; 3876 days -= absCeil(monthsToDays(monthsFromDays)); 3877 3878 // 12 months -> 1 year 3879 years = absFloor(months / 12); 3880 months %= 12; 3881 3882 data.days = days; 3883 data.months = months; 3884 data.years = years; 3885 3886 return this; 3887 } 3888 3889 function daysToMonths (days) { 3890 // 400 years have 146097 days (taking into account leap year rules) 3891 // 400 years have 12 months === 4800 3892 return days * 4800 / 146097; 3893 } 3894 3895 function monthsToDays (months) { 3896 // the reverse of daysToMonths 3897 return months * 146097 / 4800; 3898 } 3899 3900 function as (units) { 3901 var days; 3902 var months; 3903 var milliseconds = this._milliseconds; 3904 3905 units = normalizeUnits(units); 3906 3907 if (units === 'month' || units === 'year') { 3908 days = this._days + milliseconds / 864e5; 3909 months = this._months + daysToMonths(days); 3910 return units === 'month' ? months : months / 12; 3911 } else { 3912 // handle milliseconds separately because of floating point math errors (issue #1867) 3913 days = this._days + Math.round(monthsToDays(this._months)); 3914 switch (units) { 3915 case 'week' : return days / 7 + milliseconds / 6048e5; 3916 case 'day' : return days + milliseconds / 864e5; 3917 case 'hour' : return days * 24 + milliseconds / 36e5; 3918 case 'minute' : return days * 1440 + milliseconds / 6e4; 3919 case 'second' : return days * 86400 + milliseconds / 1000; 3920 // Math.floor prevents floating point math errors here 3921 case 'millisecond': return Math.floor(days * 864e5) + milliseconds; 3922 default: throw new Error('Unknown unit ' + units); 3923 } 3924 } 3925 } 3926 3927 // TODO: Use this.as('ms')? 3928 function duration_as__valueOf () { 3929 return ( 3930 this._milliseconds + 3931 this._days * 864e5 + 3932 (this._months % 12) * 2592e6 + 3933 toInt(this._months / 12) * 31536e6 3934 ); 3935 } 3936 3937 function makeAs (alias) { 3938 return function () { 3939 return this.as(alias); 3940 }; 3941 } 3942 3943 var asMilliseconds = makeAs('ms'); 3944 var asSeconds = makeAs('s'); 3945 var asMinutes = makeAs('m'); 3946 var asHours = makeAs('h'); 3947 var asDays = makeAs('d'); 3948 var asWeeks = makeAs('w'); 3949 var asMonths = makeAs('M'); 3950 var asYears = makeAs('y'); 3951 3952 function duration_get__get (units) { 3953 units = normalizeUnits(units); 3954 return this[units + 's'](); 3955 } 3956 3957 function makeGetter(name) { 3958 return function () { 3959 return this._data[name]; 3960 }; 3961 } 3962 3963 var milliseconds = makeGetter('milliseconds'); 3964 var seconds = makeGetter('seconds'); 3965 var minutes = makeGetter('minutes'); 3966 var hours = makeGetter('hours'); 3967 var days = makeGetter('days'); 3968 var months = makeGetter('months'); 3969 var years = makeGetter('years'); 3970 3971 function weeks () { 3972 return absFloor(this.days() / 7); 3973 } 3974 3975 var round = Math.round; 3976 var thresholds = { 3977 s: 45, // seconds to minute 3978 m: 45, // minutes to hour 3979 h: 22, // hours to day 3980 d: 26, // days to month 3981 M: 11 // months to year 3982 }; 3983 3984 // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize 3985 function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) { 3986 return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture); 3987 } 3988 3989 function duration_humanize__relativeTime (posNegDuration, withoutSuffix, locale) { 3990 var duration = create__createDuration(posNegDuration).abs(); 3991 var seconds = round(duration.as('s')); 3992 var minutes = round(duration.as('m')); 3993 var hours = round(duration.as('h')); 3994 var days = round(duration.as('d')); 3995 var months = round(duration.as('M')); 3996 var years = round(duration.as('y')); 3997 3998 var a = seconds < thresholds.s && ['s', seconds] || 3999 minutes <= 1 && ['m'] || 4000 minutes < thresholds.m && ['mm', minutes] || 4001 hours <= 1 && ['h'] || 4002 hours < thresholds.h && ['hh', hours] || 4003 days <= 1 && ['d'] || 4004 days < thresholds.d && ['dd', days] || 4005 months <= 1 && ['M'] || 4006 months < thresholds.M && ['MM', months] || 4007 years <= 1 && ['y'] || ['yy', years]; 4008 4009 a[2] = withoutSuffix; 4010 a[3] = +posNegDuration > 0; 4011 a[4] = locale; 4012 return substituteTimeAgo.apply(null, a); 4013 } 4014 4015 // This function allows you to set the rounding function for relative time strings 4016 function duration_humanize__getSetRelativeTimeRounding (roundingFunction) { 4017 if (roundingFunction === undefined) { 4018 return round; 4019 } 4020 if (typeof(roundingFunction) === 'function') { 4021 round = roundingFunction; 4022 return true; 4023 } 4024 return false; 4025 } 4026 4027 // This function allows you to set a threshold for relative time strings 4028 function duration_humanize__getSetRelativeTimeThreshold (threshold, limit) { 4029 if (thresholds[threshold] === undefined) { 4030 return false; 4031 } 4032 if (limit === undefined) { 4033 return thresholds[threshold]; 4034 } 4035 thresholds[threshold] = limit; 4036 return true; 4037 } 4038 4039 function humanize (withSuffix) { 4040 var locale = this.localeData(); 4041 var output = duration_humanize__relativeTime(this, !withSuffix, locale); 4042 4043 if (withSuffix) { 4044 output = locale.pastFuture(+this, output); 4045 } 4046 4047 return locale.postformat(output); 4048 } 4049 4050 var iso_string__abs = Math.abs; 4051 4052 function iso_string__toISOString() { 4053 // for ISO strings we do not use the normal bubbling rules: 4054 // * milliseconds bubble up until they become hours 4055 // * days do not bubble at all 4056 // * months bubble up until they become years 4057 // This is because there is no context-free conversion between hours and days 4058 // (think of clock changes) 4059 // and also not between days and months (28-31 days per month) 4060 var seconds = iso_string__abs(this._milliseconds) / 1000; 4061 var days = iso_string__abs(this._days); 4062 var months = iso_string__abs(this._months); 4063 var minutes, hours, years; 4064 4065 // 3600 seconds -> 60 minutes -> 1 hour 4066 minutes = absFloor(seconds / 60); 4067 hours = absFloor(minutes / 60); 4068 seconds %= 60; 4069 minutes %= 60; 4070 4071 // 12 months -> 1 year 4072 years = absFloor(months / 12); 4073 months %= 12; 4074 4075 4076 // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js 4077 var Y = years; 4078 var M = months; 4079 var D = days; 4080 var h = hours; 4081 var m = minutes; 4082 var s = seconds; 4083 var total = this.asSeconds(); 4084 4085 if (!total) { 4086 // this is the same as C#'s (Noda) and python (isodate)... 4087 // but not other JS (goog.date) 4088 return 'P0D'; 4089 } 4090 4091 return (total < 0 ? '-' : '') + 4092 'P' + 4093 (Y ? Y + 'Y' : '') + 4094 (M ? M + 'M' : '') + 4095 (D ? D + 'D' : '') + 4096 ((h || m || s) ? 'T' : '') + 4097 (h ? h + 'H' : '') + 4098 (m ? m + 'M' : '') + 4099 (s ? s + 'S' : ''); 4100 } 4101 4102 var duration_prototype__proto = Duration.prototype; 4103 4104 duration_prototype__proto.abs = duration_abs__abs; 4105 duration_prototype__proto.add = duration_add_subtract__add; 4106 duration_prototype__proto.subtract = duration_add_subtract__subtract; 4107 duration_prototype__proto.as = as; 4108 duration_prototype__proto.asMilliseconds = asMilliseconds; 4109 duration_prototype__proto.asSeconds = asSeconds; 4110 duration_prototype__proto.asMinutes = asMinutes; 4111 duration_prototype__proto.asHours = asHours; 4112 duration_prototype__proto.asDays = asDays; 4113 duration_prototype__proto.asWeeks = asWeeks; 4114 duration_prototype__proto.asMonths = asMonths; 4115 duration_prototype__proto.asYears = asYears; 4116 duration_prototype__proto.valueOf = duration_as__valueOf; 4117 duration_prototype__proto._bubble = bubble; 4118 duration_prototype__proto.get = duration_get__get; 4119 duration_prototype__proto.milliseconds = milliseconds; 4120 duration_prototype__proto.seconds = seconds; 4121 duration_prototype__proto.minutes = minutes; 4122 duration_prototype__proto.hours = hours; 4123 duration_prototype__proto.days = days; 4124 duration_prototype__proto.weeks = weeks; 4125 duration_prototype__proto.months = months; 4126 duration_prototype__proto.years = years; 4127 duration_prototype__proto.humanize = humanize; 4128 duration_prototype__proto.toISOString = iso_string__toISOString; 4129 duration_prototype__proto.toString = iso_string__toISOString; 4130 duration_prototype__proto.toJSON = iso_string__toISOString; 4131 duration_prototype__proto.locale = locale; 4132 duration_prototype__proto.localeData = localeData; 4133 4134 // Deprecations 4135 duration_prototype__proto.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', iso_string__toISOString); 4136 duration_prototype__proto.lang = lang; 4137 4138 // Side effect imports 4139 4140 // FORMATTING 4141 4142 addFormatToken('X', 0, 0, 'unix'); 4143 addFormatToken('x', 0, 0, 'valueOf'); 4144 4145 // PARSING 4146 4147 addRegexToken('x', matchSigned); 4148 addRegexToken('X', matchTimestamp); 4149 addParseToken('X', function (input, array, config) { 4150 config._d = new Date(parseFloat(input, 10) * 1000); 4151 }); 4152 addParseToken('x', function (input, array, config) { 4153 config._d = new Date(toInt(input)); 4154 }); 4155 4156 // Side effect imports 4157 4158 4159 utils_hooks__hooks.version = '2.14.1'; 4160 4161 setHookCallback(local__createLocal); 4162 4163 utils_hooks__hooks.fn = momentPrototype; 4164 utils_hooks__hooks.min = min; 4165 utils_hooks__hooks.max = max; 4166 utils_hooks__hooks.now = now; 4167 utils_hooks__hooks.utc = create_utc__createUTC; 4168 utils_hooks__hooks.unix = moment__createUnix; 4169 utils_hooks__hooks.months = lists__listMonths; 4170 utils_hooks__hooks.isDate = isDate; 4171 utils_hooks__hooks.locale = locale_locales__getSetGlobalLocale; 4172 utils_hooks__hooks.invalid = valid__createInvalid; 4173 utils_hooks__hooks.duration = create__createDuration; 4174 utils_hooks__hooks.isMoment = isMoment; 4175 utils_hooks__hooks.weekdays = lists__listWeekdays; 4176 utils_hooks__hooks.parseZone = moment__createInZone; 4177 utils_hooks__hooks.localeData = locale_locales__getLocale; 4178 utils_hooks__hooks.isDuration = isDuration; 4179 utils_hooks__hooks.monthsShort = lists__listMonthsShort; 4180 utils_hooks__hooks.weekdaysMin = lists__listWeekdaysMin; 4181 utils_hooks__hooks.defineLocale = defineLocale; 4182 utils_hooks__hooks.updateLocale = updateLocale; 4183 utils_hooks__hooks.locales = locale_locales__listLocales; 4184 utils_hooks__hooks.weekdaysShort = lists__listWeekdaysShort; 4185 utils_hooks__hooks.normalizeUnits = normalizeUnits; 4186 utils_hooks__hooks.relativeTimeRounding = duration_humanize__getSetRelativeTimeRounding; 4187 utils_hooks__hooks.relativeTimeThreshold = duration_humanize__getSetRelativeTimeThreshold; 4188 utils_hooks__hooks.calendarFormat = getCalendarFormat; 4189 utils_hooks__hooks.prototype = momentPrototype; 4190 4191 var _moment = utils_hooks__hooks; 4192 4193 return _moment; 4194 4195}));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.