@livetiles/reach-components-react 0.4.0-preview.218 → 0.4.0-preview.219

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.umd.js CHANGED
@@ -1214,16 +1214,16 @@
1214
1214
  var process$7 = global$r.process;
1215
1215
  var versions$5 = process$7 && process$7.versions;
1216
1216
  var v8$4 = versions$5 && versions$5.v8;
1217
- var match$5, version$a;
1217
+ var match$7, version$a;
1218
1218
 
1219
1219
  if (v8$4) {
1220
- match$5 = v8$4.split('.');
1221
- version$a = match$5[0] + match$5[1];
1220
+ match$7 = v8$4.split('.');
1221
+ version$a = match$7[0] + match$7[1];
1222
1222
  } else if (userAgent$5) {
1223
- match$5 = userAgent$5.match(/Edge\/(\d+)/);
1224
- if (!match$5 || match$5[1] >= 74) {
1225
- match$5 = userAgent$5.match(/Chrome\/(\d+)/);
1226
- if (match$5) version$a = match$5[1];
1223
+ match$7 = userAgent$5.match(/Edge\/(\d+)/);
1224
+ if (!match$7 || match$7[1] >= 74) {
1225
+ match$7 = userAgent$5.match(/Chrome\/(\d+)/);
1226
+ if (match$7) version$a = match$7[1];
1227
1227
  }
1228
1228
  }
1229
1229
 
@@ -41518,17 +41518,17 @@
41518
41518
  var process$1$3 = global$2$3.process;
41519
41519
  var versions$3 = process$1$3 && process$1$3.versions;
41520
41520
  var v8$3 = versions$3 && versions$3.v8;
41521
- var match$4, version$7;
41521
+ var match$6, version$7;
41522
41522
 
41523
41523
  if (v8$3) {
41524
- match$4 = v8$3.split('.');
41525
- version$7 = match$4[0] + match$4[1];
41524
+ match$6 = v8$3.split('.');
41525
+ version$7 = match$6[0] + match$6[1];
41526
41526
  } else if (userAgent$4) {
41527
- match$4 = userAgent$4.match(/Edge\/(\d+)/);
41527
+ match$6 = userAgent$4.match(/Edge\/(\d+)/);
41528
41528
 
41529
- if (!match$4 || match$4[1] >= 74) {
41530
- match$4 = userAgent$4.match(/Chrome\/(\d+)/);
41531
- if (match$4) version$7 = match$4[1];
41529
+ if (!match$6 || match$6[1] >= 74) {
41530
+ match$6 = userAgent$4.match(/Chrome\/(\d+)/);
41531
+ if (match$6) version$7 = match$6[1];
41532
41532
  }
41533
41533
  }
41534
41534
 
@@ -49753,17 +49753,17 @@
49753
49753
  var process$2$2 = global$4$2.process;
49754
49754
  var versions$2 = process$2$2 && process$2$2.versions;
49755
49755
  var v8$2 = versions$2 && versions$2.v8;
49756
- var match$3, version$6;
49756
+ var match$5, version$6;
49757
49757
 
49758
49758
  if (v8$2) {
49759
- match$3 = v8$2.split('.');
49760
- version$6 = match$3[0] + match$3[1];
49759
+ match$5 = v8$2.split('.');
49760
+ version$6 = match$5[0] + match$5[1];
49761
49761
  } else if (userAgent$3) {
49762
- match$3 = userAgent$3.match(/Edge\/(\d+)/);
49762
+ match$5 = userAgent$3.match(/Edge\/(\d+)/);
49763
49763
 
49764
- if (!match$3 || match$3[1] >= 74) {
49765
- match$3 = userAgent$3.match(/Chrome\/(\d+)/);
49766
- if (match$3) version$6 = match$3[1];
49764
+ if (!match$5 || match$5[1] >= 74) {
49765
+ match$5 = userAgent$3.match(/Chrome\/(\d+)/);
49766
+ if (match$5) version$6 = match$5[1];
49767
49767
  }
49768
49768
  }
49769
49769
 
@@ -66092,7 +66092,7 @@
66092
66092
  var booleanValueOf = Boolean.prototype.valueOf;
66093
66093
  var objectToString = Object.prototype.toString;
66094
66094
  var functionToString$2 = Function.prototype.toString;
66095
- var match$2 = String.prototype.match;
66095
+ var match$4 = String.prototype.match;
66096
66096
  var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;
66097
66097
  var gOPS = Object.getOwnPropertySymbols;
66098
66098
  var symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null;
@@ -66268,7 +66268,7 @@
66268
66268
  if (isString$1(obj)) {
66269
66269
  return markBoxed(inspect(String(obj)));
66270
66270
  }
66271
- if (!isDate(obj) && !isRegExp$8(obj)) {
66271
+ if (!isDate$1(obj) && !isRegExp$8(obj)) {
66272
66272
  var ys = arrObjKeys(obj, inspect);
66273
66273
  var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
66274
66274
  var protoTag = obj instanceof Object ? '' : 'null prototype';
@@ -66294,7 +66294,7 @@
66294
66294
  }
66295
66295
 
66296
66296
  function isArray$8(obj) { return toStr(obj) === '[object Array]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
66297
- function isDate(obj) { return toStr(obj) === '[object Date]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
66297
+ function isDate$1(obj) { return toStr(obj) === '[object Date]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
66298
66298
  function isRegExp$8(obj) { return toStr(obj) === '[object RegExp]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
66299
66299
  function isError(obj) { return toStr(obj) === '[object Error]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
66300
66300
  function isString$1(obj) { return toStr(obj) === '[object String]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
@@ -66341,7 +66341,7 @@
66341
66341
 
66342
66342
  function nameOf(f) {
66343
66343
  if (f.name) { return f.name; }
66344
- var m = match$2.call(functionToString$2.call(f), /^function\s*([\w$]+)/);
66344
+ var m = match$4.call(functionToString$2.call(f), /^function\s*([\w$]+)/);
66345
66345
  if (m) { return m[1]; }
66346
66346
  return null;
66347
66347
  }
@@ -70876,7 +70876,7 @@
70876
70876
 
70877
70877
  var defaultMessage = "Copy to clipboard: #{key}, Enter";
70878
70878
 
70879
- function format(message) {
70879
+ function format$1(message) {
70880
70880
  var copyKey = (/mac os x/i.test(navigator.userAgent) ? "⌘" : "Ctrl") + "+C";
70881
70881
  return message.replace(/#{\s*key\s*}/g, copyKey);
70882
70882
  }
@@ -70955,7 +70955,7 @@
70955
70955
  } catch (err) {
70956
70956
  debug && console.error("unable to copy using clipboardData: ", err);
70957
70957
  debug && console.error("falling back to prompt");
70958
- message = format("message" in options ? options.message : defaultMessage);
70958
+ message = format$1("message" in options ? options.message : defaultMessage);
70959
70959
  window.prompt(message, text);
70960
70960
  }
70961
70961
  } finally {
@@ -80172,17 +80172,17 @@
80172
80172
  var process$2$1 = global$2$1.process;
80173
80173
  var versions$1 = process$2$1 && process$2$1.versions;
80174
80174
  var v8$1 = versions$1 && versions$1.v8;
80175
- var match$1, version$2;
80175
+ var match$3, version$2;
80176
80176
 
80177
80177
  if (v8$1) {
80178
- match$1 = v8$1.split('.');
80179
- version$2 = match$1[0] + match$1[1];
80178
+ match$3 = v8$1.split('.');
80179
+ version$2 = match$3[0] + match$3[1];
80180
80180
  } else if (userAgent$2) {
80181
- match$1 = userAgent$2.match(/Edge\/(\d+)/);
80181
+ match$3 = userAgent$2.match(/Edge\/(\d+)/);
80182
80182
 
80183
- if (!match$1 || match$1[1] >= 74) {
80184
- match$1 = userAgent$2.match(/Chrome\/(\d+)/);
80185
- if (match$1) version$2 = match$1[1];
80183
+ if (!match$3 || match$3[1] >= 74) {
80184
+ match$3 = userAgent$2.match(/Chrome\/(\d+)/);
80185
+ if (match$3) version$2 = match$3[1];
80186
80186
  }
80187
80187
  }
80188
80188
 
@@ -87330,9 +87330,9 @@
87330
87330
  }), void 0);
87331
87331
  };
87332
87332
 
87333
- var version$1 = "0.4.0-preview.218";
87334
- var buildId = "98536";
87335
- var commitId = "53d1e2e7ca6cdb579383c5337dad032ea701dfec";
87333
+ var version$1 = "0.4.0-preview.219";
87334
+ var buildId = "98555";
87335
+ var commitId = "7017e140d89782fc7985a4be2c49f4898fab5489";
87336
87336
  var isCustomerBuild = false;
87337
87337
  var buildInfo = {
87338
87338
  version: version$1,
@@ -131493,7 +131493,7 @@
131493
131493
  // - setTimeout
131494
131494
  }else {notify$1=function(){// strange IE + webpack dev server bug - use .call(global)
131495
131495
  macrotask.call(global$6,flush);};}}var microtask$1=queueMicrotask||function(fn){var task={fn:fn,next:undefined};if(last)last.next=task;if(!head){head=task;notify$1();}last=task;};var newPromiseCapability$2={};var aFunction$4=aFunction$7;var PromiseCapability=function(C){var resolve,reject;this.promise=new C(function($$resolve,$$reject){if(resolve!==undefined||reject!==undefined)throw TypeError('Bad Promise constructor');resolve=$$resolve;reject=$$reject;});this.resolve=aFunction$4(resolve);this.reject=aFunction$4(reject);};// 25.4.1.5 NewPromiseCapability(C)
131496
- newPromiseCapability$2.f=function(C){return new PromiseCapability(C);};var anObject$2$1=anObject$h;var isObject$3=isObject$c;var newPromiseCapability$1=newPromiseCapability$2;var promiseResolve$1=function(C,x){anObject$2$1(C);if(isObject$3(x)&&x.constructor===C)return x;var promiseCapability=newPromiseCapability$1.f(C);var resolve=promiseCapability.resolve;resolve(x);return promiseCapability.promise;};var global$5=global$m;var hostReportErrors$1=function(a,b){var console=global$5.console;if(console&&console.error){arguments.length===1?console.error(a):console.error(a,b);}};var perform$1=function(exec){try{return {error:false,value:exec()};}catch(error){return {error:true,value:error};}};var global$4=global$m;var userAgent=engineUserAgent;var process$1=global$4.process;var versions=process$1&&process$1.versions;var v8=versions&&versions.v8;var match,version;if(v8){match=v8.split('.');version=match[0]+match[1];}else if(userAgent){match=userAgent.match(/Edge\/(\d+)/);if(!match||match[1]>=74){match=userAgent.match(/Chrome\/(\d+)/);if(match)version=match[1];}}var engineV8Version=version&&+version;var $$9=_export;var global$3=global$m;var getBuiltIn=getBuiltIn$6;var NativePromise=nativePromiseConstructor;var redefine$a=redefine$9.exports;var redefineAll=redefineAll$2;var setToStringTag=setToStringTag$5;var setSpecies=setSpecies$2;var isObject$2=isObject$c;var aFunction$3=aFunction$7;var anInstance=anInstance$3;var classof$1=classofRaw$1;var inspectSource=inspectSource$3;var iterate=iterate$2.exports;var checkCorrectnessOfIteration=checkCorrectnessOfIteration$1;var speciesConstructor=speciesConstructor$2;var task=task$1.set;var microtask=microtask$1;var promiseResolve=promiseResolve$1;var hostReportErrors=hostReportErrors$1;var newPromiseCapabilityModule=newPromiseCapability$2;var perform=perform$1;var InternalStateModule=internalState;var isForced=isForced_1;var wellKnownSymbol$2=wellKnownSymbol$l;var V8_VERSION=engineV8Version;var SPECIES$1=wellKnownSymbol$2('species');var PROMISE='Promise';var getInternalState=InternalStateModule.get;var setInternalState=InternalStateModule.set;var getInternalPromiseState=InternalStateModule.getterFor(PROMISE);var PromiseConstructor=NativePromise;var TypeError$1=global$3.TypeError;var document$1=global$3.document;var process$4=global$3.process;var $fetch=getBuiltIn('fetch');var newPromiseCapability=newPromiseCapabilityModule.f;var newGenericPromiseCapability=newPromiseCapability;var IS_NODE=classof$1(process$4)=='process';var DISPATCH_EVENT=!!(document$1&&document$1.createEvent&&global$3.dispatchEvent);var UNHANDLED_REJECTION='unhandledrejection';var REJECTION_HANDLED='rejectionhandled';var PENDING=0;var FULFILLED=1;var REJECTED=2;var HANDLED=1;var UNHANDLED=2;var Internal,OwnPromiseCapability,PromiseWrapper,nativeThen;var FORCED$2=isForced(PROMISE,function(){var GLOBAL_CORE_JS_PROMISE=inspectSource(PromiseConstructor)!==String(PromiseConstructor);if(!GLOBAL_CORE_JS_PROMISE){// V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
131496
+ newPromiseCapability$2.f=function(C){return new PromiseCapability(C);};var anObject$2$1=anObject$h;var isObject$3=isObject$c;var newPromiseCapability$1=newPromiseCapability$2;var promiseResolve$1=function(C,x){anObject$2$1(C);if(isObject$3(x)&&x.constructor===C)return x;var promiseCapability=newPromiseCapability$1.f(C);var resolve=promiseCapability.resolve;resolve(x);return promiseCapability.promise;};var global$5=global$m;var hostReportErrors$1=function(a,b){var console=global$5.console;if(console&&console.error){arguments.length===1?console.error(a):console.error(a,b);}};var perform$1=function(exec){try{return {error:false,value:exec()};}catch(error){return {error:true,value:error};}};var global$4=global$m;var userAgent=engineUserAgent;var process$1=global$4.process;var versions=process$1&&process$1.versions;var v8=versions&&versions.v8;var match$2,version;if(v8){match$2=v8.split('.');version=match$2[0]+match$2[1];}else if(userAgent){match$2=userAgent.match(/Edge\/(\d+)/);if(!match$2||match$2[1]>=74){match$2=userAgent.match(/Chrome\/(\d+)/);if(match$2)version=match$2[1];}}var engineV8Version=version&&+version;var $$9=_export;var global$3=global$m;var getBuiltIn=getBuiltIn$6;var NativePromise=nativePromiseConstructor;var redefine$a=redefine$9.exports;var redefineAll=redefineAll$2;var setToStringTag=setToStringTag$5;var setSpecies=setSpecies$2;var isObject$2=isObject$c;var aFunction$3=aFunction$7;var anInstance=anInstance$3;var classof$1=classofRaw$1;var inspectSource=inspectSource$3;var iterate=iterate$2.exports;var checkCorrectnessOfIteration=checkCorrectnessOfIteration$1;var speciesConstructor=speciesConstructor$2;var task=task$1.set;var microtask=microtask$1;var promiseResolve=promiseResolve$1;var hostReportErrors=hostReportErrors$1;var newPromiseCapabilityModule=newPromiseCapability$2;var perform=perform$1;var InternalStateModule=internalState;var isForced=isForced_1;var wellKnownSymbol$2=wellKnownSymbol$l;var V8_VERSION=engineV8Version;var SPECIES$1=wellKnownSymbol$2('species');var PROMISE='Promise';var getInternalState=InternalStateModule.get;var setInternalState=InternalStateModule.set;var getInternalPromiseState=InternalStateModule.getterFor(PROMISE);var PromiseConstructor=NativePromise;var TypeError$1=global$3.TypeError;var document$1=global$3.document;var process$4=global$3.process;var $fetch=getBuiltIn('fetch');var newPromiseCapability=newPromiseCapabilityModule.f;var newGenericPromiseCapability=newPromiseCapability;var IS_NODE=classof$1(process$4)=='process';var DISPATCH_EVENT=!!(document$1&&document$1.createEvent&&global$3.dispatchEvent);var UNHANDLED_REJECTION='unhandledrejection';var REJECTION_HANDLED='rejectionhandled';var PENDING=0;var FULFILLED=1;var REJECTED=2;var HANDLED=1;var UNHANDLED=2;var Internal,OwnPromiseCapability,PromiseWrapper,nativeThen;var FORCED$2=isForced(PROMISE,function(){var GLOBAL_CORE_JS_PROMISE=inspectSource(PromiseConstructor)!==String(PromiseConstructor);if(!GLOBAL_CORE_JS_PROMISE){// V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
131497
131497
  // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
131498
131498
  // We can't detect it synchronously, so just check versions
131499
131499
  if(V8_VERSION===66)return true;// Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
@@ -135245,6 +135245,36 @@
135245
135245
  }
135246
135246
  }
135247
135247
 
135248
+ /**
135249
+ * @name addMilliseconds
135250
+ * @category Millisecond Helpers
135251
+ * @summary Add the specified number of milliseconds to the given date.
135252
+ *
135253
+ * @description
135254
+ * Add the specified number of milliseconds to the given date.
135255
+ *
135256
+ * ### v2.0.0 breaking changes:
135257
+ *
135258
+ * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
135259
+ *
135260
+ * @param {Date|Number} date - the date to be changed
135261
+ * @param {Number} amount - the amount of milliseconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
135262
+ * @returns {Date} the new date with the milliseconds added
135263
+ * @throws {TypeError} 2 arguments required
135264
+ *
135265
+ * @example
135266
+ * // Add 750 milliseconds to 10 July 2014 12:45:30.000:
135267
+ * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
135268
+ * //=> Thu Jul 10 2014 12:45:30.750
135269
+ */
135270
+
135271
+ function addMilliseconds(dirtyDate, dirtyAmount) {
135272
+ requiredArgs(2, arguments);
135273
+ var timestamp = toDate(dirtyDate).getTime();
135274
+ var amount = toInteger(dirtyAmount);
135275
+ return new Date(timestamp + amount);
135276
+ }
135277
+
135248
135278
  /**
135249
135279
  * @name startOfWeek
135250
135280
  * @category Week Helpers
@@ -135297,6 +135327,23 @@
135297
135327
  return date;
135298
135328
  }
135299
135329
 
135330
+ /**
135331
+ * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
135332
+ * They usually appear for dates that denote time before the timezones were introduced
135333
+ * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
135334
+ * and GMT+01:00:00 after that date)
135335
+ *
135336
+ * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
135337
+ * which would lead to incorrect calculations.
135338
+ *
135339
+ * This function returns the timezone offset in milliseconds that takes seconds in account.
135340
+ */
135341
+ function getTimezoneOffsetInMilliseconds(date) {
135342
+ var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
135343
+ utcDate.setUTCFullYear(date.getFullYear());
135344
+ return date.getTime() - utcDate.getTime();
135345
+ }
135346
+
135300
135347
  /**
135301
135348
  * @name startOfDay
135302
135349
  * @category Day Helpers
@@ -135327,6 +135374,117 @@
135327
135374
  return date;
135328
135375
  }
135329
135376
 
135377
+ /**
135378
+ * @name isDate
135379
+ * @category Common Helpers
135380
+ * @summary Is the given value a date?
135381
+ *
135382
+ * @description
135383
+ * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
135384
+ *
135385
+ * ### v2.0.0 breaking changes:
135386
+ *
135387
+ * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
135388
+ *
135389
+ * @param {*} value - the value to check
135390
+ * @returns {boolean} true if the given value is a date
135391
+ * @throws {TypeError} 1 arguments required
135392
+ *
135393
+ * @example
135394
+ * // For a valid date:
135395
+ * const result = isDate(new Date())
135396
+ * //=> true
135397
+ *
135398
+ * @example
135399
+ * // For an invalid date:
135400
+ * const result = isDate(new Date(NaN))
135401
+ * //=> true
135402
+ *
135403
+ * @example
135404
+ * // For some value:
135405
+ * const result = isDate('2014-02-31')
135406
+ * //=> false
135407
+ *
135408
+ * @example
135409
+ * // For an object:
135410
+ * const result = isDate({})
135411
+ * //=> false
135412
+ */
135413
+
135414
+ function isDate(value) {
135415
+ requiredArgs(1, arguments);
135416
+ return value instanceof Date || typeof value === 'object' && Object.prototype.toString.call(value) === '[object Date]';
135417
+ }
135418
+
135419
+ /**
135420
+ * @name isValid
135421
+ * @category Common Helpers
135422
+ * @summary Is the given date valid?
135423
+ *
135424
+ * @description
135425
+ * Returns false if argument is Invalid Date and true otherwise.
135426
+ * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
135427
+ * Invalid Date is a Date, whose time value is NaN.
135428
+ *
135429
+ * Time value of Date: http://es5.github.io/#x15.9.1.1
135430
+ *
135431
+ * ### v2.0.0 breaking changes:
135432
+ *
135433
+ * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
135434
+ *
135435
+ * - Now `isValid` doesn't throw an exception
135436
+ * if the first argument is not an instance of Date.
135437
+ * Instead, argument is converted beforehand using `toDate`.
135438
+ *
135439
+ * Examples:
135440
+ *
135441
+ * | `isValid` argument | Before v2.0.0 | v2.0.0 onward |
135442
+ * |---------------------------|---------------|---------------|
135443
+ * | `new Date()` | `true` | `true` |
135444
+ * | `new Date('2016-01-01')` | `true` | `true` |
135445
+ * | `new Date('')` | `false` | `false` |
135446
+ * | `new Date(1488370835081)` | `true` | `true` |
135447
+ * | `new Date(NaN)` | `false` | `false` |
135448
+ * | `'2016-01-01'` | `TypeError` | `false` |
135449
+ * | `''` | `TypeError` | `false` |
135450
+ * | `1488370835081` | `TypeError` | `true` |
135451
+ * | `NaN` | `TypeError` | `false` |
135452
+ *
135453
+ * We introduce this change to make *date-fns* consistent with ECMAScript behavior
135454
+ * that try to coerce arguments to the expected type
135455
+ * (which is also the case with other *date-fns* functions).
135456
+ *
135457
+ * @param {*} date - the date to check
135458
+ * @returns {Boolean} the date is valid
135459
+ * @throws {TypeError} 1 argument required
135460
+ *
135461
+ * @example
135462
+ * // For the valid date:
135463
+ * const result = isValid(new Date(2014, 1, 31))
135464
+ * //=> true
135465
+ *
135466
+ * @example
135467
+ * // For the value, convertable into a date:
135468
+ * const result = isValid(1393804800000)
135469
+ * //=> true
135470
+ *
135471
+ * @example
135472
+ * // For the invalid date:
135473
+ * const result = isValid(new Date(''))
135474
+ * //=> false
135475
+ */
135476
+
135477
+ function isValid(dirtyDate) {
135478
+ requiredArgs(1, arguments);
135479
+
135480
+ if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
135481
+ return false;
135482
+ }
135483
+
135484
+ var date = toDate(dirtyDate);
135485
+ return !isNaN(Number(date));
135486
+ }
135487
+
135330
135488
  /**
135331
135489
  * @name endOfDay
135332
135490
  * @category Day Helpers
@@ -135471,6 +135629,2200 @@
135471
135629
  return date;
135472
135630
  }
135473
135631
 
135632
+ var formatDistanceLocale = {
135633
+ lessThanXSeconds: {
135634
+ one: 'less than a second',
135635
+ other: 'less than {{count}} seconds'
135636
+ },
135637
+ xSeconds: {
135638
+ one: '1 second',
135639
+ other: '{{count}} seconds'
135640
+ },
135641
+ halfAMinute: 'half a minute',
135642
+ lessThanXMinutes: {
135643
+ one: 'less than a minute',
135644
+ other: 'less than {{count}} minutes'
135645
+ },
135646
+ xMinutes: {
135647
+ one: '1 minute',
135648
+ other: '{{count}} minutes'
135649
+ },
135650
+ aboutXHours: {
135651
+ one: 'about 1 hour',
135652
+ other: 'about {{count}} hours'
135653
+ },
135654
+ xHours: {
135655
+ one: '1 hour',
135656
+ other: '{{count}} hours'
135657
+ },
135658
+ xDays: {
135659
+ one: '1 day',
135660
+ other: '{{count}} days'
135661
+ },
135662
+ aboutXWeeks: {
135663
+ one: 'about 1 week',
135664
+ other: 'about {{count}} weeks'
135665
+ },
135666
+ xWeeks: {
135667
+ one: '1 week',
135668
+ other: '{{count}} weeks'
135669
+ },
135670
+ aboutXMonths: {
135671
+ one: 'about 1 month',
135672
+ other: 'about {{count}} months'
135673
+ },
135674
+ xMonths: {
135675
+ one: '1 month',
135676
+ other: '{{count}} months'
135677
+ },
135678
+ aboutXYears: {
135679
+ one: 'about 1 year',
135680
+ other: 'about {{count}} years'
135681
+ },
135682
+ xYears: {
135683
+ one: '1 year',
135684
+ other: '{{count}} years'
135685
+ },
135686
+ overXYears: {
135687
+ one: 'over 1 year',
135688
+ other: 'over {{count}} years'
135689
+ },
135690
+ almostXYears: {
135691
+ one: 'almost 1 year',
135692
+ other: 'almost {{count}} years'
135693
+ }
135694
+ };
135695
+
135696
+ var formatDistance = function (token, count, options) {
135697
+ var result;
135698
+ var tokenValue = formatDistanceLocale[token];
135699
+
135700
+ if (typeof tokenValue === 'string') {
135701
+ result = tokenValue;
135702
+ } else if (count === 1) {
135703
+ result = tokenValue.one;
135704
+ } else {
135705
+ result = tokenValue.other.replace('{{count}}', count.toString());
135706
+ }
135707
+
135708
+ if (options !== null && options !== void 0 && options.addSuffix) {
135709
+ if (options.comparison && options.comparison > 0) {
135710
+ return 'in ' + result;
135711
+ } else {
135712
+ return result + ' ago';
135713
+ }
135714
+ }
135715
+
135716
+ return result;
135717
+ };
135718
+
135719
+ var formatDistance$1 = formatDistance;
135720
+
135721
+ function buildFormatLongFn(args) {
135722
+ return function () {
135723
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
135724
+ // TODO: Remove String()
135725
+ var width = options.width ? String(options.width) : args.defaultWidth;
135726
+ var format = args.formats[width] || args.formats[args.defaultWidth];
135727
+ return format;
135728
+ };
135729
+ }
135730
+
135731
+ var dateFormats = {
135732
+ full: 'EEEE, MMMM do, y',
135733
+ long: 'MMMM do, y',
135734
+ medium: 'MMM d, y',
135735
+ short: 'MM/dd/yyyy'
135736
+ };
135737
+ var timeFormats = {
135738
+ full: 'h:mm:ss a zzzz',
135739
+ long: 'h:mm:ss a z',
135740
+ medium: 'h:mm:ss a',
135741
+ short: 'h:mm a'
135742
+ };
135743
+ var dateTimeFormats = {
135744
+ full: "{{date}} 'at' {{time}}",
135745
+ long: "{{date}} 'at' {{time}}",
135746
+ medium: '{{date}}, {{time}}',
135747
+ short: '{{date}}, {{time}}'
135748
+ };
135749
+ var formatLong = {
135750
+ date: buildFormatLongFn({
135751
+ formats: dateFormats,
135752
+ defaultWidth: 'full'
135753
+ }),
135754
+ time: buildFormatLongFn({
135755
+ formats: timeFormats,
135756
+ defaultWidth: 'full'
135757
+ }),
135758
+ dateTime: buildFormatLongFn({
135759
+ formats: dateTimeFormats,
135760
+ defaultWidth: 'full'
135761
+ })
135762
+ };
135763
+ var formatLong$1 = formatLong;
135764
+
135765
+ var formatRelativeLocale = {
135766
+ lastWeek: "'last' eeee 'at' p",
135767
+ yesterday: "'yesterday at' p",
135768
+ today: "'today at' p",
135769
+ tomorrow: "'tomorrow at' p",
135770
+ nextWeek: "eeee 'at' p",
135771
+ other: 'P'
135772
+ };
135773
+
135774
+ var formatRelative = function (token, _date, _baseDate, _options) {
135775
+ return formatRelativeLocale[token];
135776
+ };
135777
+
135778
+ var formatRelative$1 = formatRelative;
135779
+
135780
+ function buildLocalizeFn(args) {
135781
+ return function (dirtyIndex, dirtyOptions) {
135782
+ var options = dirtyOptions || {};
135783
+ var context = options.context ? String(options.context) : 'standalone';
135784
+ var valuesArray;
135785
+
135786
+ if (context === 'formatting' && args.formattingValues) {
135787
+ var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
135788
+ var width = options.width ? String(options.width) : defaultWidth;
135789
+ valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
135790
+ } else {
135791
+ var _defaultWidth = args.defaultWidth;
135792
+
135793
+ var _width = options.width ? String(options.width) : args.defaultWidth;
135794
+
135795
+ valuesArray = args.values[_width] || args.values[_defaultWidth];
135796
+ }
135797
+
135798
+ var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex; // @ts-ignore: For some reason TypeScript just don't want to match it, no matter how hard we try. I challange you to try to remove it!
135799
+
135800
+ return valuesArray[index];
135801
+ };
135802
+ }
135803
+
135804
+ var eraValues = {
135805
+ narrow: ['B', 'A'],
135806
+ abbreviated: ['BC', 'AD'],
135807
+ wide: ['Before Christ', 'Anno Domini']
135808
+ };
135809
+ var quarterValues = {
135810
+ narrow: ['1', '2', '3', '4'],
135811
+ abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
135812
+ wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
135813
+ }; // Note: in English, the names of days of the week and months are capitalized.
135814
+ // If you are making a new locale based on this one, check if the same is true for the language you're working on.
135815
+ // Generally, formatted dates should look like they are in the middle of a sentence,
135816
+ // e.g. in Spanish language the weekdays and months should be in the lowercase.
135817
+
135818
+ var monthValues = {
135819
+ narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
135820
+ abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
135821
+ wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
135822
+ };
135823
+ var dayValues = {
135824
+ narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
135825
+ short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
135826
+ abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
135827
+ wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
135828
+ };
135829
+ var dayPeriodValues = {
135830
+ narrow: {
135831
+ am: 'a',
135832
+ pm: 'p',
135833
+ midnight: 'mi',
135834
+ noon: 'n',
135835
+ morning: 'morning',
135836
+ afternoon: 'afternoon',
135837
+ evening: 'evening',
135838
+ night: 'night'
135839
+ },
135840
+ abbreviated: {
135841
+ am: 'AM',
135842
+ pm: 'PM',
135843
+ midnight: 'midnight',
135844
+ noon: 'noon',
135845
+ morning: 'morning',
135846
+ afternoon: 'afternoon',
135847
+ evening: 'evening',
135848
+ night: 'night'
135849
+ },
135850
+ wide: {
135851
+ am: 'a.m.',
135852
+ pm: 'p.m.',
135853
+ midnight: 'midnight',
135854
+ noon: 'noon',
135855
+ morning: 'morning',
135856
+ afternoon: 'afternoon',
135857
+ evening: 'evening',
135858
+ night: 'night'
135859
+ }
135860
+ };
135861
+ var formattingDayPeriodValues = {
135862
+ narrow: {
135863
+ am: 'a',
135864
+ pm: 'p',
135865
+ midnight: 'mi',
135866
+ noon: 'n',
135867
+ morning: 'in the morning',
135868
+ afternoon: 'in the afternoon',
135869
+ evening: 'in the evening',
135870
+ night: 'at night'
135871
+ },
135872
+ abbreviated: {
135873
+ am: 'AM',
135874
+ pm: 'PM',
135875
+ midnight: 'midnight',
135876
+ noon: 'noon',
135877
+ morning: 'in the morning',
135878
+ afternoon: 'in the afternoon',
135879
+ evening: 'in the evening',
135880
+ night: 'at night'
135881
+ },
135882
+ wide: {
135883
+ am: 'a.m.',
135884
+ pm: 'p.m.',
135885
+ midnight: 'midnight',
135886
+ noon: 'noon',
135887
+ morning: 'in the morning',
135888
+ afternoon: 'in the afternoon',
135889
+ evening: 'in the evening',
135890
+ night: 'at night'
135891
+ }
135892
+ };
135893
+
135894
+ var ordinalNumber = function (dirtyNumber, _options) {
135895
+ var number = Number(dirtyNumber); // If ordinal numbers depend on context, for example,
135896
+ // if they are different for different grammatical genders,
135897
+ // use `options.unit`.
135898
+ //
135899
+ // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
135900
+ // 'day', 'hour', 'minute', 'second'.
135901
+
135902
+ var rem100 = number % 100;
135903
+
135904
+ if (rem100 > 20 || rem100 < 10) {
135905
+ switch (rem100 % 10) {
135906
+ case 1:
135907
+ return number + 'st';
135908
+
135909
+ case 2:
135910
+ return number + 'nd';
135911
+
135912
+ case 3:
135913
+ return number + 'rd';
135914
+ }
135915
+ }
135916
+
135917
+ return number + 'th';
135918
+ };
135919
+
135920
+ var localize = {
135921
+ ordinalNumber: ordinalNumber,
135922
+ era: buildLocalizeFn({
135923
+ values: eraValues,
135924
+ defaultWidth: 'wide'
135925
+ }),
135926
+ quarter: buildLocalizeFn({
135927
+ values: quarterValues,
135928
+ defaultWidth: 'wide',
135929
+ argumentCallback: function (quarter) {
135930
+ return quarter - 1;
135931
+ }
135932
+ }),
135933
+ month: buildLocalizeFn({
135934
+ values: monthValues,
135935
+ defaultWidth: 'wide'
135936
+ }),
135937
+ day: buildLocalizeFn({
135938
+ values: dayValues,
135939
+ defaultWidth: 'wide'
135940
+ }),
135941
+ dayPeriod: buildLocalizeFn({
135942
+ values: dayPeriodValues,
135943
+ defaultWidth: 'wide',
135944
+ formattingValues: formattingDayPeriodValues,
135945
+ defaultFormattingWidth: 'wide'
135946
+ })
135947
+ };
135948
+ var localize$1 = localize;
135949
+
135950
+ function buildMatchFn(args) {
135951
+ return function (string) {
135952
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
135953
+ var width = options.width;
135954
+ var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
135955
+ var matchResult = string.match(matchPattern);
135956
+
135957
+ if (!matchResult) {
135958
+ return null;
135959
+ }
135960
+
135961
+ var matchedString = matchResult[0];
135962
+ var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
135963
+ var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {
135964
+ return pattern.test(matchedString);
135965
+ }) : findKey(parsePatterns, function (pattern) {
135966
+ return pattern.test(matchedString);
135967
+ });
135968
+ var value;
135969
+ value = args.valueCallback ? args.valueCallback(key) : key;
135970
+ value = options.valueCallback ? options.valueCallback(value) : value;
135971
+ var rest = string.slice(matchedString.length);
135972
+ return {
135973
+ value: value,
135974
+ rest: rest
135975
+ };
135976
+ };
135977
+ }
135978
+
135979
+ function findKey(object, predicate) {
135980
+ for (var key in object) {
135981
+ if (object.hasOwnProperty(key) && predicate(object[key])) {
135982
+ return key;
135983
+ }
135984
+ }
135985
+
135986
+ return undefined;
135987
+ }
135988
+
135989
+ function findIndex(array, predicate) {
135990
+ for (var key = 0; key < array.length; key++) {
135991
+ if (predicate(array[key])) {
135992
+ return key;
135993
+ }
135994
+ }
135995
+
135996
+ return undefined;
135997
+ }
135998
+
135999
+ function buildMatchPatternFn(args) {
136000
+ return function (string) {
136001
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
136002
+ var matchResult = string.match(args.matchPattern);
136003
+ if (!matchResult) return null;
136004
+ var matchedString = matchResult[0];
136005
+ var parseResult = string.match(args.parsePattern);
136006
+ if (!parseResult) return null;
136007
+ var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
136008
+ value = options.valueCallback ? options.valueCallback(value) : value;
136009
+ var rest = string.slice(matchedString.length);
136010
+ return {
136011
+ value: value,
136012
+ rest: rest
136013
+ };
136014
+ };
136015
+ }
136016
+
136017
+ var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
136018
+ var parseOrdinalNumberPattern = /\d+/i;
136019
+ var matchEraPatterns = {
136020
+ narrow: /^(b|a)/i,
136021
+ abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
136022
+ wide: /^(before christ|before common era|anno domini|common era)/i
136023
+ };
136024
+ var parseEraPatterns = {
136025
+ any: [/^b/i, /^(a|c)/i]
136026
+ };
136027
+ var matchQuarterPatterns = {
136028
+ narrow: /^[1234]/i,
136029
+ abbreviated: /^q[1234]/i,
136030
+ wide: /^[1234](th|st|nd|rd)? quarter/i
136031
+ };
136032
+ var parseQuarterPatterns = {
136033
+ any: [/1/i, /2/i, /3/i, /4/i]
136034
+ };
136035
+ var matchMonthPatterns = {
136036
+ narrow: /^[jfmasond]/i,
136037
+ abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
136038
+ wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
136039
+ };
136040
+ var parseMonthPatterns = {
136041
+ narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],
136042
+ any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]
136043
+ };
136044
+ var matchDayPatterns = {
136045
+ narrow: /^[smtwf]/i,
136046
+ short: /^(su|mo|tu|we|th|fr|sa)/i,
136047
+ abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
136048
+ wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
136049
+ };
136050
+ var parseDayPatterns = {
136051
+ narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
136052
+ any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
136053
+ };
136054
+ var matchDayPeriodPatterns = {
136055
+ narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
136056
+ any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
136057
+ };
136058
+ var parseDayPeriodPatterns = {
136059
+ any: {
136060
+ am: /^a/i,
136061
+ pm: /^p/i,
136062
+ midnight: /^mi/i,
136063
+ noon: /^no/i,
136064
+ morning: /morning/i,
136065
+ afternoon: /afternoon/i,
136066
+ evening: /evening/i,
136067
+ night: /night/i
136068
+ }
136069
+ };
136070
+ var match = {
136071
+ ordinalNumber: buildMatchPatternFn({
136072
+ matchPattern: matchOrdinalNumberPattern,
136073
+ parsePattern: parseOrdinalNumberPattern,
136074
+ valueCallback: function (value) {
136075
+ return parseInt(value, 10);
136076
+ }
136077
+ }),
136078
+ era: buildMatchFn({
136079
+ matchPatterns: matchEraPatterns,
136080
+ defaultMatchWidth: 'wide',
136081
+ parsePatterns: parseEraPatterns,
136082
+ defaultParseWidth: 'any'
136083
+ }),
136084
+ quarter: buildMatchFn({
136085
+ matchPatterns: matchQuarterPatterns,
136086
+ defaultMatchWidth: 'wide',
136087
+ parsePatterns: parseQuarterPatterns,
136088
+ defaultParseWidth: 'any',
136089
+ valueCallback: function (index) {
136090
+ return index + 1;
136091
+ }
136092
+ }),
136093
+ month: buildMatchFn({
136094
+ matchPatterns: matchMonthPatterns,
136095
+ defaultMatchWidth: 'wide',
136096
+ parsePatterns: parseMonthPatterns,
136097
+ defaultParseWidth: 'any'
136098
+ }),
136099
+ day: buildMatchFn({
136100
+ matchPatterns: matchDayPatterns,
136101
+ defaultMatchWidth: 'wide',
136102
+ parsePatterns: parseDayPatterns,
136103
+ defaultParseWidth: 'any'
136104
+ }),
136105
+ dayPeriod: buildMatchFn({
136106
+ matchPatterns: matchDayPeriodPatterns,
136107
+ defaultMatchWidth: 'any',
136108
+ parsePatterns: parseDayPeriodPatterns,
136109
+ defaultParseWidth: 'any'
136110
+ })
136111
+ };
136112
+ var match$1 = match;
136113
+
136114
+ /**
136115
+ * @type {Locale}
136116
+ * @category Locales
136117
+ * @summary English locale (United States).
136118
+ * @language English
136119
+ * @iso-639-2 eng
136120
+ * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
136121
+ * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
136122
+ */
136123
+ var locale = {
136124
+ code: 'en-US',
136125
+ formatDistance: formatDistance$1,
136126
+ formatLong: formatLong$1,
136127
+ formatRelative: formatRelative$1,
136128
+ localize: localize$1,
136129
+ match: match$1,
136130
+ options: {
136131
+ weekStartsOn: 0
136132
+ /* Sunday */
136133
+ ,
136134
+ firstWeekContainsDate: 1
136135
+ }
136136
+ };
136137
+ var defaultLocale = locale;
136138
+
136139
+ /**
136140
+ * @name subMilliseconds
136141
+ * @category Millisecond Helpers
136142
+ * @summary Subtract the specified number of milliseconds from the given date.
136143
+ *
136144
+ * @description
136145
+ * Subtract the specified number of milliseconds from the given date.
136146
+ *
136147
+ * ### v2.0.0 breaking changes:
136148
+ *
136149
+ * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
136150
+ *
136151
+ * @param {Date|Number} date - the date to be changed
136152
+ * @param {Number} amount - the amount of milliseconds to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
136153
+ * @returns {Date} the new date with the milliseconds subtracted
136154
+ * @throws {TypeError} 2 arguments required
136155
+ *
136156
+ * @example
136157
+ * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
136158
+ * const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
136159
+ * //=> Thu Jul 10 2014 12:45:29.250
136160
+ */
136161
+
136162
+ function subMilliseconds(dirtyDate, dirtyAmount) {
136163
+ requiredArgs(2, arguments);
136164
+ var amount = toInteger(dirtyAmount);
136165
+ return addMilliseconds(dirtyDate, -amount);
136166
+ }
136167
+
136168
+ function addLeadingZeros(number, targetLength) {
136169
+ var sign = number < 0 ? '-' : '';
136170
+ var output = Math.abs(number).toString();
136171
+
136172
+ while (output.length < targetLength) {
136173
+ output = '0' + output;
136174
+ }
136175
+
136176
+ return sign + output;
136177
+ }
136178
+
136179
+ /*
136180
+ * | | Unit | | Unit |
136181
+ * |-----|--------------------------------|-----|--------------------------------|
136182
+ * | a | AM, PM | A* | |
136183
+ * | d | Day of month | D | |
136184
+ * | h | Hour [1-12] | H | Hour [0-23] |
136185
+ * | m | Minute | M | Month |
136186
+ * | s | Second | S | Fraction of second |
136187
+ * | y | Year (abs) | Y | |
136188
+ *
136189
+ * Letters marked by * are not implemented but reserved by Unicode standard.
136190
+ */
136191
+
136192
+ var formatters$2 = {
136193
+ // Year
136194
+ y: function (date, token) {
136195
+ // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
136196
+ // | Year | y | yy | yyy | yyyy | yyyyy |
136197
+ // |----------|-------|----|-------|-------|-------|
136198
+ // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
136199
+ // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
136200
+ // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
136201
+ // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
136202
+ // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
136203
+ var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)
136204
+
136205
+ var year = signedYear > 0 ? signedYear : 1 - signedYear;
136206
+ return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
136207
+ },
136208
+ // Month
136209
+ M: function (date, token) {
136210
+ var month = date.getUTCMonth();
136211
+ return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
136212
+ },
136213
+ // Day of the month
136214
+ d: function (date, token) {
136215
+ return addLeadingZeros(date.getUTCDate(), token.length);
136216
+ },
136217
+ // AM or PM
136218
+ a: function (date, token) {
136219
+ var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
136220
+
136221
+ switch (token) {
136222
+ case 'a':
136223
+ case 'aa':
136224
+ return dayPeriodEnumValue.toUpperCase();
136225
+
136226
+ case 'aaa':
136227
+ return dayPeriodEnumValue;
136228
+
136229
+ case 'aaaaa':
136230
+ return dayPeriodEnumValue[0];
136231
+
136232
+ case 'aaaa':
136233
+ default:
136234
+ return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
136235
+ }
136236
+ },
136237
+ // Hour [1-12]
136238
+ h: function (date, token) {
136239
+ return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
136240
+ },
136241
+ // Hour [0-23]
136242
+ H: function (date, token) {
136243
+ return addLeadingZeros(date.getUTCHours(), token.length);
136244
+ },
136245
+ // Minute
136246
+ m: function (date, token) {
136247
+ return addLeadingZeros(date.getUTCMinutes(), token.length);
136248
+ },
136249
+ // Second
136250
+ s: function (date, token) {
136251
+ return addLeadingZeros(date.getUTCSeconds(), token.length);
136252
+ },
136253
+ // Fraction of second
136254
+ S: function (date, token) {
136255
+ var numberOfDigits = token.length;
136256
+ var milliseconds = date.getUTCMilliseconds();
136257
+ var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
136258
+ return addLeadingZeros(fractionalSeconds, token.length);
136259
+ }
136260
+ };
136261
+ var formatters$3 = formatters$2;
136262
+
136263
+ var MILLISECONDS_IN_DAY = 86400000; // This function will be a part of public API when UTC function will be implemented.
136264
+ // See issue: https://github.com/date-fns/date-fns/issues/376
136265
+
136266
+ function getUTCDayOfYear(dirtyDate) {
136267
+ requiredArgs(1, arguments);
136268
+ var date = toDate(dirtyDate);
136269
+ var timestamp = date.getTime();
136270
+ date.setUTCMonth(0, 1);
136271
+ date.setUTCHours(0, 0, 0, 0);
136272
+ var startOfYearTimestamp = date.getTime();
136273
+ var difference = timestamp - startOfYearTimestamp;
136274
+ return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
136275
+ }
136276
+
136277
+ // See issue: https://github.com/date-fns/date-fns/issues/376
136278
+
136279
+ function startOfUTCISOWeek(dirtyDate) {
136280
+ requiredArgs(1, arguments);
136281
+ var weekStartsOn = 1;
136282
+ var date = toDate(dirtyDate);
136283
+ var day = date.getUTCDay();
136284
+ var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
136285
+ date.setUTCDate(date.getUTCDate() - diff);
136286
+ date.setUTCHours(0, 0, 0, 0);
136287
+ return date;
136288
+ }
136289
+
136290
+ // See issue: https://github.com/date-fns/date-fns/issues/376
136291
+
136292
+ function getUTCISOWeekYear(dirtyDate) {
136293
+ requiredArgs(1, arguments);
136294
+ var date = toDate(dirtyDate);
136295
+ var year = date.getUTCFullYear();
136296
+ var fourthOfJanuaryOfNextYear = new Date(0);
136297
+ fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
136298
+ fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
136299
+ var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);
136300
+ var fourthOfJanuaryOfThisYear = new Date(0);
136301
+ fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
136302
+ fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
136303
+ var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);
136304
+
136305
+ if (date.getTime() >= startOfNextYear.getTime()) {
136306
+ return year + 1;
136307
+ } else if (date.getTime() >= startOfThisYear.getTime()) {
136308
+ return year;
136309
+ } else {
136310
+ return year - 1;
136311
+ }
136312
+ }
136313
+
136314
+ // See issue: https://github.com/date-fns/date-fns/issues/376
136315
+
136316
+ function startOfUTCISOWeekYear(dirtyDate) {
136317
+ requiredArgs(1, arguments);
136318
+ var year = getUTCISOWeekYear(dirtyDate);
136319
+ var fourthOfJanuary = new Date(0);
136320
+ fourthOfJanuary.setUTCFullYear(year, 0, 4);
136321
+ fourthOfJanuary.setUTCHours(0, 0, 0, 0);
136322
+ var date = startOfUTCISOWeek(fourthOfJanuary);
136323
+ return date;
136324
+ }
136325
+
136326
+ var MILLISECONDS_IN_WEEK$1 = 604800000; // This function will be a part of public API when UTC function will be implemented.
136327
+ // See issue: https://github.com/date-fns/date-fns/issues/376
136328
+
136329
+ function getUTCISOWeek(dirtyDate) {
136330
+ requiredArgs(1, arguments);
136331
+ var date = toDate(dirtyDate);
136332
+ var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime(); // Round the number of days to the nearest integer
136333
+ // because the number of milliseconds in a week is not constant
136334
+ // (e.g. it's different in the week of the daylight saving time clock shift)
136335
+
136336
+ return Math.round(diff / MILLISECONDS_IN_WEEK$1) + 1;
136337
+ }
136338
+
136339
+ // See issue: https://github.com/date-fns/date-fns/issues/376
136340
+
136341
+ function startOfUTCWeek(dirtyDate, dirtyOptions) {
136342
+ requiredArgs(1, arguments);
136343
+ var options = dirtyOptions || {};
136344
+ var locale = options.locale;
136345
+ var localeWeekStartsOn = locale && locale.options && locale.options.weekStartsOn;
136346
+ var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
136347
+ var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
136348
+
136349
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
136350
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
136351
+ }
136352
+
136353
+ var date = toDate(dirtyDate);
136354
+ var day = date.getUTCDay();
136355
+ var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
136356
+ date.setUTCDate(date.getUTCDate() - diff);
136357
+ date.setUTCHours(0, 0, 0, 0);
136358
+ return date;
136359
+ }
136360
+
136361
+ // See issue: https://github.com/date-fns/date-fns/issues/376
136362
+
136363
+ function getUTCWeekYear(dirtyDate, dirtyOptions) {
136364
+ requiredArgs(1, arguments);
136365
+ var date = toDate(dirtyDate, dirtyOptions);
136366
+ var year = date.getUTCFullYear();
136367
+ var options = dirtyOptions || {};
136368
+ var locale = options.locale;
136369
+ var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate;
136370
+ var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
136371
+ var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
136372
+
136373
+ if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
136374
+ throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
136375
+ }
136376
+
136377
+ var firstWeekOfNextYear = new Date(0);
136378
+ firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
136379
+ firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
136380
+ var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, dirtyOptions);
136381
+ var firstWeekOfThisYear = new Date(0);
136382
+ firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
136383
+ firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
136384
+ var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, dirtyOptions);
136385
+
136386
+ if (date.getTime() >= startOfNextYear.getTime()) {
136387
+ return year + 1;
136388
+ } else if (date.getTime() >= startOfThisYear.getTime()) {
136389
+ return year;
136390
+ } else {
136391
+ return year - 1;
136392
+ }
136393
+ }
136394
+
136395
+ // See issue: https://github.com/date-fns/date-fns/issues/376
136396
+
136397
+ function startOfUTCWeekYear(dirtyDate, dirtyOptions) {
136398
+ requiredArgs(1, arguments);
136399
+ var options = dirtyOptions || {};
136400
+ var locale = options.locale;
136401
+ var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate;
136402
+ var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
136403
+ var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate);
136404
+ var year = getUTCWeekYear(dirtyDate, dirtyOptions);
136405
+ var firstWeek = new Date(0);
136406
+ firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
136407
+ firstWeek.setUTCHours(0, 0, 0, 0);
136408
+ var date = startOfUTCWeek(firstWeek, dirtyOptions);
136409
+ return date;
136410
+ }
136411
+
136412
+ var MILLISECONDS_IN_WEEK = 604800000; // This function will be a part of public API when UTC function will be implemented.
136413
+ // See issue: https://github.com/date-fns/date-fns/issues/376
136414
+
136415
+ function getUTCWeek(dirtyDate, options) {
136416
+ requiredArgs(1, arguments);
136417
+ var date = toDate(dirtyDate);
136418
+ var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime(); // Round the number of days to the nearest integer
136419
+ // because the number of milliseconds in a week is not constant
136420
+ // (e.g. it's different in the week of the daylight saving time clock shift)
136421
+
136422
+ return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
136423
+ }
136424
+
136425
+ var dayPeriodEnum = {
136426
+ am: 'am',
136427
+ pm: 'pm',
136428
+ midnight: 'midnight',
136429
+ noon: 'noon',
136430
+ morning: 'morning',
136431
+ afternoon: 'afternoon',
136432
+ evening: 'evening',
136433
+ night: 'night'
136434
+ };
136435
+ /*
136436
+ * | | Unit | | Unit |
136437
+ * |-----|--------------------------------|-----|--------------------------------|
136438
+ * | a | AM, PM | A* | Milliseconds in day |
136439
+ * | b | AM, PM, noon, midnight | B | Flexible day period |
136440
+ * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
136441
+ * | d | Day of month | D | Day of year |
136442
+ * | e | Local day of week | E | Day of week |
136443
+ * | f | | F* | Day of week in month |
136444
+ * | g* | Modified Julian day | G | Era |
136445
+ * | h | Hour [1-12] | H | Hour [0-23] |
136446
+ * | i! | ISO day of week | I! | ISO week of year |
136447
+ * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
136448
+ * | k | Hour [1-24] | K | Hour [0-11] |
136449
+ * | l* | (deprecated) | L | Stand-alone month |
136450
+ * | m | Minute | M | Month |
136451
+ * | n | | N | |
136452
+ * | o! | Ordinal number modifier | O | Timezone (GMT) |
136453
+ * | p! | Long localized time | P! | Long localized date |
136454
+ * | q | Stand-alone quarter | Q | Quarter |
136455
+ * | r* | Related Gregorian year | R! | ISO week-numbering year |
136456
+ * | s | Second | S | Fraction of second |
136457
+ * | t! | Seconds timestamp | T! | Milliseconds timestamp |
136458
+ * | u | Extended year | U* | Cyclic year |
136459
+ * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
136460
+ * | w | Local week of year | W* | Week of month |
136461
+ * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
136462
+ * | y | Year (abs) | Y | Local week-numbering year |
136463
+ * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
136464
+ *
136465
+ * Letters marked by * are not implemented but reserved by Unicode standard.
136466
+ *
136467
+ * Letters marked by ! are non-standard, but implemented by date-fns:
136468
+ * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
136469
+ * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
136470
+ * i.e. 7 for Sunday, 1 for Monday, etc.
136471
+ * - `I` is ISO week of year, as opposed to `w` which is local week of year.
136472
+ * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
136473
+ * `R` is supposed to be used in conjunction with `I` and `i`
136474
+ * for universal ISO week-numbering date, whereas
136475
+ * `Y` is supposed to be used in conjunction with `w` and `e`
136476
+ * for week-numbering date specific to the locale.
136477
+ * - `P` is long localized date format
136478
+ * - `p` is long localized time format
136479
+ */
136480
+
136481
+ var formatters = {
136482
+ // Era
136483
+ G: function (date, token, localize) {
136484
+ var era = date.getUTCFullYear() > 0 ? 1 : 0;
136485
+
136486
+ switch (token) {
136487
+ // AD, BC
136488
+ case 'G':
136489
+ case 'GG':
136490
+ case 'GGG':
136491
+ return localize.era(era, {
136492
+ width: 'abbreviated'
136493
+ });
136494
+ // A, B
136495
+
136496
+ case 'GGGGG':
136497
+ return localize.era(era, {
136498
+ width: 'narrow'
136499
+ });
136500
+ // Anno Domini, Before Christ
136501
+
136502
+ case 'GGGG':
136503
+ default:
136504
+ return localize.era(era, {
136505
+ width: 'wide'
136506
+ });
136507
+ }
136508
+ },
136509
+ // Year
136510
+ y: function (date, token, localize) {
136511
+ // Ordinal number
136512
+ if (token === 'yo') {
136513
+ var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)
136514
+
136515
+ var year = signedYear > 0 ? signedYear : 1 - signedYear;
136516
+ return localize.ordinalNumber(year, {
136517
+ unit: 'year'
136518
+ });
136519
+ }
136520
+
136521
+ return formatters$3.y(date, token);
136522
+ },
136523
+ // Local week-numbering year
136524
+ Y: function (date, token, localize, options) {
136525
+ var signedWeekYear = getUTCWeekYear(date, options); // Returns 1 for 1 BC (which is year 0 in JavaScript)
136526
+
136527
+ var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; // Two digit year
136528
+
136529
+ if (token === 'YY') {
136530
+ var twoDigitYear = weekYear % 100;
136531
+ return addLeadingZeros(twoDigitYear, 2);
136532
+ } // Ordinal number
136533
+
136534
+
136535
+ if (token === 'Yo') {
136536
+ return localize.ordinalNumber(weekYear, {
136537
+ unit: 'year'
136538
+ });
136539
+ } // Padding
136540
+
136541
+
136542
+ return addLeadingZeros(weekYear, token.length);
136543
+ },
136544
+ // ISO week-numbering year
136545
+ R: function (date, token) {
136546
+ var isoWeekYear = getUTCISOWeekYear(date); // Padding
136547
+
136548
+ return addLeadingZeros(isoWeekYear, token.length);
136549
+ },
136550
+ // Extended year. This is a single number designating the year of this calendar system.
136551
+ // The main difference between `y` and `u` localizers are B.C. years:
136552
+ // | Year | `y` | `u` |
136553
+ // |------|-----|-----|
136554
+ // | AC 1 | 1 | 1 |
136555
+ // | BC 1 | 1 | 0 |
136556
+ // | BC 2 | 2 | -1 |
136557
+ // Also `yy` always returns the last two digits of a year,
136558
+ // while `uu` pads single digit years to 2 characters and returns other years unchanged.
136559
+ u: function (date, token) {
136560
+ var year = date.getUTCFullYear();
136561
+ return addLeadingZeros(year, token.length);
136562
+ },
136563
+ // Quarter
136564
+ Q: function (date, token, localize) {
136565
+ var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
136566
+
136567
+ switch (token) {
136568
+ // 1, 2, 3, 4
136569
+ case 'Q':
136570
+ return String(quarter);
136571
+ // 01, 02, 03, 04
136572
+
136573
+ case 'QQ':
136574
+ return addLeadingZeros(quarter, 2);
136575
+ // 1st, 2nd, 3rd, 4th
136576
+
136577
+ case 'Qo':
136578
+ return localize.ordinalNumber(quarter, {
136579
+ unit: 'quarter'
136580
+ });
136581
+ // Q1, Q2, Q3, Q4
136582
+
136583
+ case 'QQQ':
136584
+ return localize.quarter(quarter, {
136585
+ width: 'abbreviated',
136586
+ context: 'formatting'
136587
+ });
136588
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
136589
+
136590
+ case 'QQQQQ':
136591
+ return localize.quarter(quarter, {
136592
+ width: 'narrow',
136593
+ context: 'formatting'
136594
+ });
136595
+ // 1st quarter, 2nd quarter, ...
136596
+
136597
+ case 'QQQQ':
136598
+ default:
136599
+ return localize.quarter(quarter, {
136600
+ width: 'wide',
136601
+ context: 'formatting'
136602
+ });
136603
+ }
136604
+ },
136605
+ // Stand-alone quarter
136606
+ q: function (date, token, localize) {
136607
+ var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
136608
+
136609
+ switch (token) {
136610
+ // 1, 2, 3, 4
136611
+ case 'q':
136612
+ return String(quarter);
136613
+ // 01, 02, 03, 04
136614
+
136615
+ case 'qq':
136616
+ return addLeadingZeros(quarter, 2);
136617
+ // 1st, 2nd, 3rd, 4th
136618
+
136619
+ case 'qo':
136620
+ return localize.ordinalNumber(quarter, {
136621
+ unit: 'quarter'
136622
+ });
136623
+ // Q1, Q2, Q3, Q4
136624
+
136625
+ case 'qqq':
136626
+ return localize.quarter(quarter, {
136627
+ width: 'abbreviated',
136628
+ context: 'standalone'
136629
+ });
136630
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
136631
+
136632
+ case 'qqqqq':
136633
+ return localize.quarter(quarter, {
136634
+ width: 'narrow',
136635
+ context: 'standalone'
136636
+ });
136637
+ // 1st quarter, 2nd quarter, ...
136638
+
136639
+ case 'qqqq':
136640
+ default:
136641
+ return localize.quarter(quarter, {
136642
+ width: 'wide',
136643
+ context: 'standalone'
136644
+ });
136645
+ }
136646
+ },
136647
+ // Month
136648
+ M: function (date, token, localize) {
136649
+ var month = date.getUTCMonth();
136650
+
136651
+ switch (token) {
136652
+ case 'M':
136653
+ case 'MM':
136654
+ return formatters$3.M(date, token);
136655
+ // 1st, 2nd, ..., 12th
136656
+
136657
+ case 'Mo':
136658
+ return localize.ordinalNumber(month + 1, {
136659
+ unit: 'month'
136660
+ });
136661
+ // Jan, Feb, ..., Dec
136662
+
136663
+ case 'MMM':
136664
+ return localize.month(month, {
136665
+ width: 'abbreviated',
136666
+ context: 'formatting'
136667
+ });
136668
+ // J, F, ..., D
136669
+
136670
+ case 'MMMMM':
136671
+ return localize.month(month, {
136672
+ width: 'narrow',
136673
+ context: 'formatting'
136674
+ });
136675
+ // January, February, ..., December
136676
+
136677
+ case 'MMMM':
136678
+ default:
136679
+ return localize.month(month, {
136680
+ width: 'wide',
136681
+ context: 'formatting'
136682
+ });
136683
+ }
136684
+ },
136685
+ // Stand-alone month
136686
+ L: function (date, token, localize) {
136687
+ var month = date.getUTCMonth();
136688
+
136689
+ switch (token) {
136690
+ // 1, 2, ..., 12
136691
+ case 'L':
136692
+ return String(month + 1);
136693
+ // 01, 02, ..., 12
136694
+
136695
+ case 'LL':
136696
+ return addLeadingZeros(month + 1, 2);
136697
+ // 1st, 2nd, ..., 12th
136698
+
136699
+ case 'Lo':
136700
+ return localize.ordinalNumber(month + 1, {
136701
+ unit: 'month'
136702
+ });
136703
+ // Jan, Feb, ..., Dec
136704
+
136705
+ case 'LLL':
136706
+ return localize.month(month, {
136707
+ width: 'abbreviated',
136708
+ context: 'standalone'
136709
+ });
136710
+ // J, F, ..., D
136711
+
136712
+ case 'LLLLL':
136713
+ return localize.month(month, {
136714
+ width: 'narrow',
136715
+ context: 'standalone'
136716
+ });
136717
+ // January, February, ..., December
136718
+
136719
+ case 'LLLL':
136720
+ default:
136721
+ return localize.month(month, {
136722
+ width: 'wide',
136723
+ context: 'standalone'
136724
+ });
136725
+ }
136726
+ },
136727
+ // Local week of year
136728
+ w: function (date, token, localize, options) {
136729
+ var week = getUTCWeek(date, options);
136730
+
136731
+ if (token === 'wo') {
136732
+ return localize.ordinalNumber(week, {
136733
+ unit: 'week'
136734
+ });
136735
+ }
136736
+
136737
+ return addLeadingZeros(week, token.length);
136738
+ },
136739
+ // ISO week of year
136740
+ I: function (date, token, localize) {
136741
+ var isoWeek = getUTCISOWeek(date);
136742
+
136743
+ if (token === 'Io') {
136744
+ return localize.ordinalNumber(isoWeek, {
136745
+ unit: 'week'
136746
+ });
136747
+ }
136748
+
136749
+ return addLeadingZeros(isoWeek, token.length);
136750
+ },
136751
+ // Day of the month
136752
+ d: function (date, token, localize) {
136753
+ if (token === 'do') {
136754
+ return localize.ordinalNumber(date.getUTCDate(), {
136755
+ unit: 'date'
136756
+ });
136757
+ }
136758
+
136759
+ return formatters$3.d(date, token);
136760
+ },
136761
+ // Day of year
136762
+ D: function (date, token, localize) {
136763
+ var dayOfYear = getUTCDayOfYear(date);
136764
+
136765
+ if (token === 'Do') {
136766
+ return localize.ordinalNumber(dayOfYear, {
136767
+ unit: 'dayOfYear'
136768
+ });
136769
+ }
136770
+
136771
+ return addLeadingZeros(dayOfYear, token.length);
136772
+ },
136773
+ // Day of week
136774
+ E: function (date, token, localize) {
136775
+ var dayOfWeek = date.getUTCDay();
136776
+
136777
+ switch (token) {
136778
+ // Tue
136779
+ case 'E':
136780
+ case 'EE':
136781
+ case 'EEE':
136782
+ return localize.day(dayOfWeek, {
136783
+ width: 'abbreviated',
136784
+ context: 'formatting'
136785
+ });
136786
+ // T
136787
+
136788
+ case 'EEEEE':
136789
+ return localize.day(dayOfWeek, {
136790
+ width: 'narrow',
136791
+ context: 'formatting'
136792
+ });
136793
+ // Tu
136794
+
136795
+ case 'EEEEEE':
136796
+ return localize.day(dayOfWeek, {
136797
+ width: 'short',
136798
+ context: 'formatting'
136799
+ });
136800
+ // Tuesday
136801
+
136802
+ case 'EEEE':
136803
+ default:
136804
+ return localize.day(dayOfWeek, {
136805
+ width: 'wide',
136806
+ context: 'formatting'
136807
+ });
136808
+ }
136809
+ },
136810
+ // Local day of week
136811
+ e: function (date, token, localize, options) {
136812
+ var dayOfWeek = date.getUTCDay();
136813
+ var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
136814
+
136815
+ switch (token) {
136816
+ // Numerical value (Nth day of week with current locale or weekStartsOn)
136817
+ case 'e':
136818
+ return String(localDayOfWeek);
136819
+ // Padded numerical value
136820
+
136821
+ case 'ee':
136822
+ return addLeadingZeros(localDayOfWeek, 2);
136823
+ // 1st, 2nd, ..., 7th
136824
+
136825
+ case 'eo':
136826
+ return localize.ordinalNumber(localDayOfWeek, {
136827
+ unit: 'day'
136828
+ });
136829
+
136830
+ case 'eee':
136831
+ return localize.day(dayOfWeek, {
136832
+ width: 'abbreviated',
136833
+ context: 'formatting'
136834
+ });
136835
+ // T
136836
+
136837
+ case 'eeeee':
136838
+ return localize.day(dayOfWeek, {
136839
+ width: 'narrow',
136840
+ context: 'formatting'
136841
+ });
136842
+ // Tu
136843
+
136844
+ case 'eeeeee':
136845
+ return localize.day(dayOfWeek, {
136846
+ width: 'short',
136847
+ context: 'formatting'
136848
+ });
136849
+ // Tuesday
136850
+
136851
+ case 'eeee':
136852
+ default:
136853
+ return localize.day(dayOfWeek, {
136854
+ width: 'wide',
136855
+ context: 'formatting'
136856
+ });
136857
+ }
136858
+ },
136859
+ // Stand-alone local day of week
136860
+ c: function (date, token, localize, options) {
136861
+ var dayOfWeek = date.getUTCDay();
136862
+ var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
136863
+
136864
+ switch (token) {
136865
+ // Numerical value (same as in `e`)
136866
+ case 'c':
136867
+ return String(localDayOfWeek);
136868
+ // Padded numerical value
136869
+
136870
+ case 'cc':
136871
+ return addLeadingZeros(localDayOfWeek, token.length);
136872
+ // 1st, 2nd, ..., 7th
136873
+
136874
+ case 'co':
136875
+ return localize.ordinalNumber(localDayOfWeek, {
136876
+ unit: 'day'
136877
+ });
136878
+
136879
+ case 'ccc':
136880
+ return localize.day(dayOfWeek, {
136881
+ width: 'abbreviated',
136882
+ context: 'standalone'
136883
+ });
136884
+ // T
136885
+
136886
+ case 'ccccc':
136887
+ return localize.day(dayOfWeek, {
136888
+ width: 'narrow',
136889
+ context: 'standalone'
136890
+ });
136891
+ // Tu
136892
+
136893
+ case 'cccccc':
136894
+ return localize.day(dayOfWeek, {
136895
+ width: 'short',
136896
+ context: 'standalone'
136897
+ });
136898
+ // Tuesday
136899
+
136900
+ case 'cccc':
136901
+ default:
136902
+ return localize.day(dayOfWeek, {
136903
+ width: 'wide',
136904
+ context: 'standalone'
136905
+ });
136906
+ }
136907
+ },
136908
+ // ISO day of week
136909
+ i: function (date, token, localize) {
136910
+ var dayOfWeek = date.getUTCDay();
136911
+ var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
136912
+
136913
+ switch (token) {
136914
+ // 2
136915
+ case 'i':
136916
+ return String(isoDayOfWeek);
136917
+ // 02
136918
+
136919
+ case 'ii':
136920
+ return addLeadingZeros(isoDayOfWeek, token.length);
136921
+ // 2nd
136922
+
136923
+ case 'io':
136924
+ return localize.ordinalNumber(isoDayOfWeek, {
136925
+ unit: 'day'
136926
+ });
136927
+ // Tue
136928
+
136929
+ case 'iii':
136930
+ return localize.day(dayOfWeek, {
136931
+ width: 'abbreviated',
136932
+ context: 'formatting'
136933
+ });
136934
+ // T
136935
+
136936
+ case 'iiiii':
136937
+ return localize.day(dayOfWeek, {
136938
+ width: 'narrow',
136939
+ context: 'formatting'
136940
+ });
136941
+ // Tu
136942
+
136943
+ case 'iiiiii':
136944
+ return localize.day(dayOfWeek, {
136945
+ width: 'short',
136946
+ context: 'formatting'
136947
+ });
136948
+ // Tuesday
136949
+
136950
+ case 'iiii':
136951
+ default:
136952
+ return localize.day(dayOfWeek, {
136953
+ width: 'wide',
136954
+ context: 'formatting'
136955
+ });
136956
+ }
136957
+ },
136958
+ // AM or PM
136959
+ a: function (date, token, localize) {
136960
+ var hours = date.getUTCHours();
136961
+ var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
136962
+
136963
+ switch (token) {
136964
+ case 'a':
136965
+ case 'aa':
136966
+ return localize.dayPeriod(dayPeriodEnumValue, {
136967
+ width: 'abbreviated',
136968
+ context: 'formatting'
136969
+ });
136970
+
136971
+ case 'aaa':
136972
+ return localize.dayPeriod(dayPeriodEnumValue, {
136973
+ width: 'abbreviated',
136974
+ context: 'formatting'
136975
+ }).toLowerCase();
136976
+
136977
+ case 'aaaaa':
136978
+ return localize.dayPeriod(dayPeriodEnumValue, {
136979
+ width: 'narrow',
136980
+ context: 'formatting'
136981
+ });
136982
+
136983
+ case 'aaaa':
136984
+ default:
136985
+ return localize.dayPeriod(dayPeriodEnumValue, {
136986
+ width: 'wide',
136987
+ context: 'formatting'
136988
+ });
136989
+ }
136990
+ },
136991
+ // AM, PM, midnight, noon
136992
+ b: function (date, token, localize) {
136993
+ var hours = date.getUTCHours();
136994
+ var dayPeriodEnumValue;
136995
+
136996
+ if (hours === 12) {
136997
+ dayPeriodEnumValue = dayPeriodEnum.noon;
136998
+ } else if (hours === 0) {
136999
+ dayPeriodEnumValue = dayPeriodEnum.midnight;
137000
+ } else {
137001
+ dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
137002
+ }
137003
+
137004
+ switch (token) {
137005
+ case 'b':
137006
+ case 'bb':
137007
+ return localize.dayPeriod(dayPeriodEnumValue, {
137008
+ width: 'abbreviated',
137009
+ context: 'formatting'
137010
+ });
137011
+
137012
+ case 'bbb':
137013
+ return localize.dayPeriod(dayPeriodEnumValue, {
137014
+ width: 'abbreviated',
137015
+ context: 'formatting'
137016
+ }).toLowerCase();
137017
+
137018
+ case 'bbbbb':
137019
+ return localize.dayPeriod(dayPeriodEnumValue, {
137020
+ width: 'narrow',
137021
+ context: 'formatting'
137022
+ });
137023
+
137024
+ case 'bbbb':
137025
+ default:
137026
+ return localize.dayPeriod(dayPeriodEnumValue, {
137027
+ width: 'wide',
137028
+ context: 'formatting'
137029
+ });
137030
+ }
137031
+ },
137032
+ // in the morning, in the afternoon, in the evening, at night
137033
+ B: function (date, token, localize) {
137034
+ var hours = date.getUTCHours();
137035
+ var dayPeriodEnumValue;
137036
+
137037
+ if (hours >= 17) {
137038
+ dayPeriodEnumValue = dayPeriodEnum.evening;
137039
+ } else if (hours >= 12) {
137040
+ dayPeriodEnumValue = dayPeriodEnum.afternoon;
137041
+ } else if (hours >= 4) {
137042
+ dayPeriodEnumValue = dayPeriodEnum.morning;
137043
+ } else {
137044
+ dayPeriodEnumValue = dayPeriodEnum.night;
137045
+ }
137046
+
137047
+ switch (token) {
137048
+ case 'B':
137049
+ case 'BB':
137050
+ case 'BBB':
137051
+ return localize.dayPeriod(dayPeriodEnumValue, {
137052
+ width: 'abbreviated',
137053
+ context: 'formatting'
137054
+ });
137055
+
137056
+ case 'BBBBB':
137057
+ return localize.dayPeriod(dayPeriodEnumValue, {
137058
+ width: 'narrow',
137059
+ context: 'formatting'
137060
+ });
137061
+
137062
+ case 'BBBB':
137063
+ default:
137064
+ return localize.dayPeriod(dayPeriodEnumValue, {
137065
+ width: 'wide',
137066
+ context: 'formatting'
137067
+ });
137068
+ }
137069
+ },
137070
+ // Hour [1-12]
137071
+ h: function (date, token, localize) {
137072
+ if (token === 'ho') {
137073
+ var hours = date.getUTCHours() % 12;
137074
+ if (hours === 0) hours = 12;
137075
+ return localize.ordinalNumber(hours, {
137076
+ unit: 'hour'
137077
+ });
137078
+ }
137079
+
137080
+ return formatters$3.h(date, token);
137081
+ },
137082
+ // Hour [0-23]
137083
+ H: function (date, token, localize) {
137084
+ if (token === 'Ho') {
137085
+ return localize.ordinalNumber(date.getUTCHours(), {
137086
+ unit: 'hour'
137087
+ });
137088
+ }
137089
+
137090
+ return formatters$3.H(date, token);
137091
+ },
137092
+ // Hour [0-11]
137093
+ K: function (date, token, localize) {
137094
+ var hours = date.getUTCHours() % 12;
137095
+
137096
+ if (token === 'Ko') {
137097
+ return localize.ordinalNumber(hours, {
137098
+ unit: 'hour'
137099
+ });
137100
+ }
137101
+
137102
+ return addLeadingZeros(hours, token.length);
137103
+ },
137104
+ // Hour [1-24]
137105
+ k: function (date, token, localize) {
137106
+ var hours = date.getUTCHours();
137107
+ if (hours === 0) hours = 24;
137108
+
137109
+ if (token === 'ko') {
137110
+ return localize.ordinalNumber(hours, {
137111
+ unit: 'hour'
137112
+ });
137113
+ }
137114
+
137115
+ return addLeadingZeros(hours, token.length);
137116
+ },
137117
+ // Minute
137118
+ m: function (date, token, localize) {
137119
+ if (token === 'mo') {
137120
+ return localize.ordinalNumber(date.getUTCMinutes(), {
137121
+ unit: 'minute'
137122
+ });
137123
+ }
137124
+
137125
+ return formatters$3.m(date, token);
137126
+ },
137127
+ // Second
137128
+ s: function (date, token, localize) {
137129
+ if (token === 'so') {
137130
+ return localize.ordinalNumber(date.getUTCSeconds(), {
137131
+ unit: 'second'
137132
+ });
137133
+ }
137134
+
137135
+ return formatters$3.s(date, token);
137136
+ },
137137
+ // Fraction of second
137138
+ S: function (date, token) {
137139
+ return formatters$3.S(date, token);
137140
+ },
137141
+ // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
137142
+ X: function (date, token, _localize, options) {
137143
+ var originalDate = options._originalDate || date;
137144
+ var timezoneOffset = originalDate.getTimezoneOffset();
137145
+
137146
+ if (timezoneOffset === 0) {
137147
+ return 'Z';
137148
+ }
137149
+
137150
+ switch (token) {
137151
+ // Hours and optional minutes
137152
+ case 'X':
137153
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
137154
+ // Hours, minutes and optional seconds without `:` delimiter
137155
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
137156
+ // so this token always has the same output as `XX`
137157
+
137158
+ case 'XXXX':
137159
+ case 'XX':
137160
+ // Hours and minutes without `:` delimiter
137161
+ return formatTimezone(timezoneOffset);
137162
+ // Hours, minutes and optional seconds with `:` delimiter
137163
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
137164
+ // so this token always has the same output as `XXX`
137165
+
137166
+ case 'XXXXX':
137167
+ case 'XXX': // Hours and minutes with `:` delimiter
137168
+
137169
+ default:
137170
+ return formatTimezone(timezoneOffset, ':');
137171
+ }
137172
+ },
137173
+ // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
137174
+ x: function (date, token, _localize, options) {
137175
+ var originalDate = options._originalDate || date;
137176
+ var timezoneOffset = originalDate.getTimezoneOffset();
137177
+
137178
+ switch (token) {
137179
+ // Hours and optional minutes
137180
+ case 'x':
137181
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
137182
+ // Hours, minutes and optional seconds without `:` delimiter
137183
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
137184
+ // so this token always has the same output as `xx`
137185
+
137186
+ case 'xxxx':
137187
+ case 'xx':
137188
+ // Hours and minutes without `:` delimiter
137189
+ return formatTimezone(timezoneOffset);
137190
+ // Hours, minutes and optional seconds with `:` delimiter
137191
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
137192
+ // so this token always has the same output as `xxx`
137193
+
137194
+ case 'xxxxx':
137195
+ case 'xxx': // Hours and minutes with `:` delimiter
137196
+
137197
+ default:
137198
+ return formatTimezone(timezoneOffset, ':');
137199
+ }
137200
+ },
137201
+ // Timezone (GMT)
137202
+ O: function (date, token, _localize, options) {
137203
+ var originalDate = options._originalDate || date;
137204
+ var timezoneOffset = originalDate.getTimezoneOffset();
137205
+
137206
+ switch (token) {
137207
+ // Short
137208
+ case 'O':
137209
+ case 'OO':
137210
+ case 'OOO':
137211
+ return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
137212
+ // Long
137213
+
137214
+ case 'OOOO':
137215
+ default:
137216
+ return 'GMT' + formatTimezone(timezoneOffset, ':');
137217
+ }
137218
+ },
137219
+ // Timezone (specific non-location)
137220
+ z: function (date, token, _localize, options) {
137221
+ var originalDate = options._originalDate || date;
137222
+ var timezoneOffset = originalDate.getTimezoneOffset();
137223
+
137224
+ switch (token) {
137225
+ // Short
137226
+ case 'z':
137227
+ case 'zz':
137228
+ case 'zzz':
137229
+ return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
137230
+ // Long
137231
+
137232
+ case 'zzzz':
137233
+ default:
137234
+ return 'GMT' + formatTimezone(timezoneOffset, ':');
137235
+ }
137236
+ },
137237
+ // Seconds timestamp
137238
+ t: function (date, token, _localize, options) {
137239
+ var originalDate = options._originalDate || date;
137240
+ var timestamp = Math.floor(originalDate.getTime() / 1000);
137241
+ return addLeadingZeros(timestamp, token.length);
137242
+ },
137243
+ // Milliseconds timestamp
137244
+ T: function (date, token, _localize, options) {
137245
+ var originalDate = options._originalDate || date;
137246
+ var timestamp = originalDate.getTime();
137247
+ return addLeadingZeros(timestamp, token.length);
137248
+ }
137249
+ };
137250
+
137251
+ function formatTimezoneShort(offset, dirtyDelimiter) {
137252
+ var sign = offset > 0 ? '-' : '+';
137253
+ var absOffset = Math.abs(offset);
137254
+ var hours = Math.floor(absOffset / 60);
137255
+ var minutes = absOffset % 60;
137256
+
137257
+ if (minutes === 0) {
137258
+ return sign + String(hours);
137259
+ }
137260
+
137261
+ var delimiter = dirtyDelimiter || '';
137262
+ return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
137263
+ }
137264
+
137265
+ function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
137266
+ if (offset % 60 === 0) {
137267
+ var sign = offset > 0 ? '-' : '+';
137268
+ return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
137269
+ }
137270
+
137271
+ return formatTimezone(offset, dirtyDelimiter);
137272
+ }
137273
+
137274
+ function formatTimezone(offset, dirtyDelimiter) {
137275
+ var delimiter = dirtyDelimiter || '';
137276
+ var sign = offset > 0 ? '-' : '+';
137277
+ var absOffset = Math.abs(offset);
137278
+ var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
137279
+ var minutes = addLeadingZeros(absOffset % 60, 2);
137280
+ return sign + hours + delimiter + minutes;
137281
+ }
137282
+
137283
+ var formatters$1 = formatters;
137284
+
137285
+ function dateLongFormatter(pattern, formatLong) {
137286
+ switch (pattern) {
137287
+ case 'P':
137288
+ return formatLong.date({
137289
+ width: 'short'
137290
+ });
137291
+
137292
+ case 'PP':
137293
+ return formatLong.date({
137294
+ width: 'medium'
137295
+ });
137296
+
137297
+ case 'PPP':
137298
+ return formatLong.date({
137299
+ width: 'long'
137300
+ });
137301
+
137302
+ case 'PPPP':
137303
+ default:
137304
+ return formatLong.date({
137305
+ width: 'full'
137306
+ });
137307
+ }
137308
+ }
137309
+
137310
+ function timeLongFormatter(pattern, formatLong) {
137311
+ switch (pattern) {
137312
+ case 'p':
137313
+ return formatLong.time({
137314
+ width: 'short'
137315
+ });
137316
+
137317
+ case 'pp':
137318
+ return formatLong.time({
137319
+ width: 'medium'
137320
+ });
137321
+
137322
+ case 'ppp':
137323
+ return formatLong.time({
137324
+ width: 'long'
137325
+ });
137326
+
137327
+ case 'pppp':
137328
+ default:
137329
+ return formatLong.time({
137330
+ width: 'full'
137331
+ });
137332
+ }
137333
+ }
137334
+
137335
+ function dateTimeLongFormatter(pattern, formatLong) {
137336
+ var matchResult = pattern.match(/(P+)(p+)?/);
137337
+ var datePattern = matchResult[1];
137338
+ var timePattern = matchResult[2];
137339
+
137340
+ if (!timePattern) {
137341
+ return dateLongFormatter(pattern, formatLong);
137342
+ }
137343
+
137344
+ var dateTimeFormat;
137345
+
137346
+ switch (datePattern) {
137347
+ case 'P':
137348
+ dateTimeFormat = formatLong.dateTime({
137349
+ width: 'short'
137350
+ });
137351
+ break;
137352
+
137353
+ case 'PP':
137354
+ dateTimeFormat = formatLong.dateTime({
137355
+ width: 'medium'
137356
+ });
137357
+ break;
137358
+
137359
+ case 'PPP':
137360
+ dateTimeFormat = formatLong.dateTime({
137361
+ width: 'long'
137362
+ });
137363
+ break;
137364
+
137365
+ case 'PPPP':
137366
+ default:
137367
+ dateTimeFormat = formatLong.dateTime({
137368
+ width: 'full'
137369
+ });
137370
+ break;
137371
+ }
137372
+
137373
+ return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
137374
+ }
137375
+
137376
+ var longFormatters = {
137377
+ p: timeLongFormatter,
137378
+ P: dateTimeLongFormatter
137379
+ };
137380
+ var longFormatters$1 = longFormatters;
137381
+
137382
+ var protectedDayOfYearTokens = ['D', 'DD'];
137383
+ var protectedWeekYearTokens = ['YY', 'YYYY'];
137384
+ function isProtectedDayOfYearToken(token) {
137385
+ return protectedDayOfYearTokens.indexOf(token) !== -1;
137386
+ }
137387
+ function isProtectedWeekYearToken(token) {
137388
+ return protectedWeekYearTokens.indexOf(token) !== -1;
137389
+ }
137390
+ function throwProtectedError(token, format, input) {
137391
+ if (token === 'YYYY') {
137392
+ throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
137393
+ } else if (token === 'YY') {
137394
+ throw new RangeError("Use `yy` instead of `YY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
137395
+ } else if (token === 'D') {
137396
+ throw new RangeError("Use `d` instead of `D` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://git.io/fxCyr"));
137397
+ } else if (token === 'DD') {
137398
+ throw new RangeError("Use `dd` instead of `DD` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://git.io/fxCyr"));
137399
+ }
137400
+ }
137401
+
137402
+ // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
137403
+ // (one of the certain letters followed by `o`)
137404
+ // - (\w)\1* matches any sequences of the same letter
137405
+ // - '' matches two quote characters in a row
137406
+ // - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
137407
+ // except a single quote symbol, which ends the sequence.
137408
+ // Two quote characters do not end the sequence.
137409
+ // If there is no matching single quote
137410
+ // then the sequence will continue until the end of the string.
137411
+ // - . matches any single character unmatched by previous parts of the RegExps
137412
+
137413
+ var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; // This RegExp catches symbols escaped by quotes, and also
137414
+ // sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
137415
+
137416
+ var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
137417
+ var escapedStringRegExp = /^'([^]*?)'?$/;
137418
+ var doubleQuoteRegExp = /''/g;
137419
+ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
137420
+ /**
137421
+ * @name format
137422
+ * @category Common Helpers
137423
+ * @summary Format the date.
137424
+ *
137425
+ * @description
137426
+ * Return the formatted date string in the given format. The result may vary by locale.
137427
+ *
137428
+ * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
137429
+ * > See: https://git.io/fxCyr
137430
+ *
137431
+ * The characters wrapped between two single quotes characters (') are escaped.
137432
+ * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
137433
+ * (see the last example)
137434
+ *
137435
+ * Format of the string is based on Unicode Technical Standard #35:
137436
+ * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
137437
+ * with a few additions (see note 7 below the table).
137438
+ *
137439
+ * Accepted patterns:
137440
+ * | Unit | Pattern | Result examples | Notes |
137441
+ * |---------------------------------|---------|-----------------------------------|-------|
137442
+ * | Era | G..GGG | AD, BC | |
137443
+ * | | GGGG | Anno Domini, Before Christ | 2 |
137444
+ * | | GGGGG | A, B | |
137445
+ * | Calendar year | y | 44, 1, 1900, 2017 | 5 |
137446
+ * | | yo | 44th, 1st, 0th, 17th | 5,7 |
137447
+ * | | yy | 44, 01, 00, 17 | 5 |
137448
+ * | | yyy | 044, 001, 1900, 2017 | 5 |
137449
+ * | | yyyy | 0044, 0001, 1900, 2017 | 5 |
137450
+ * | | yyyyy | ... | 3,5 |
137451
+ * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
137452
+ * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
137453
+ * | | YY | 44, 01, 00, 17 | 5,8 |
137454
+ * | | YYY | 044, 001, 1900, 2017 | 5 |
137455
+ * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
137456
+ * | | YYYYY | ... | 3,5 |
137457
+ * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
137458
+ * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
137459
+ * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
137460
+ * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
137461
+ * | | RRRRR | ... | 3,5,7 |
137462
+ * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
137463
+ * | | uu | -43, 01, 1900, 2017 | 5 |
137464
+ * | | uuu | -043, 001, 1900, 2017 | 5 |
137465
+ * | | uuuu | -0043, 0001, 1900, 2017 | 5 |
137466
+ * | | uuuuu | ... | 3,5 |
137467
+ * | Quarter (formatting) | Q | 1, 2, 3, 4 | |
137468
+ * | | Qo | 1st, 2nd, 3rd, 4th | 7 |
137469
+ * | | QQ | 01, 02, 03, 04 | |
137470
+ * | | QQQ | Q1, Q2, Q3, Q4 | |
137471
+ * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
137472
+ * | | QQQQQ | 1, 2, 3, 4 | 4 |
137473
+ * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
137474
+ * | | qo | 1st, 2nd, 3rd, 4th | 7 |
137475
+ * | | qq | 01, 02, 03, 04 | |
137476
+ * | | qqq | Q1, Q2, Q3, Q4 | |
137477
+ * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
137478
+ * | | qqqqq | 1, 2, 3, 4 | 4 |
137479
+ * | Month (formatting) | M | 1, 2, ..., 12 | |
137480
+ * | | Mo | 1st, 2nd, ..., 12th | 7 |
137481
+ * | | MM | 01, 02, ..., 12 | |
137482
+ * | | MMM | Jan, Feb, ..., Dec | |
137483
+ * | | MMMM | January, February, ..., December | 2 |
137484
+ * | | MMMMM | J, F, ..., D | |
137485
+ * | Month (stand-alone) | L | 1, 2, ..., 12 | |
137486
+ * | | Lo | 1st, 2nd, ..., 12th | 7 |
137487
+ * | | LL | 01, 02, ..., 12 | |
137488
+ * | | LLL | Jan, Feb, ..., Dec | |
137489
+ * | | LLLL | January, February, ..., December | 2 |
137490
+ * | | LLLLL | J, F, ..., D | |
137491
+ * | Local week of year | w | 1, 2, ..., 53 | |
137492
+ * | | wo | 1st, 2nd, ..., 53th | 7 |
137493
+ * | | ww | 01, 02, ..., 53 | |
137494
+ * | ISO week of year | I | 1, 2, ..., 53 | 7 |
137495
+ * | | Io | 1st, 2nd, ..., 53th | 7 |
137496
+ * | | II | 01, 02, ..., 53 | 7 |
137497
+ * | Day of month | d | 1, 2, ..., 31 | |
137498
+ * | | do | 1st, 2nd, ..., 31st | 7 |
137499
+ * | | dd | 01, 02, ..., 31 | |
137500
+ * | Day of year | D | 1, 2, ..., 365, 366 | 9 |
137501
+ * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
137502
+ * | | DD | 01, 02, ..., 365, 366 | 9 |
137503
+ * | | DDD | 001, 002, ..., 365, 366 | |
137504
+ * | | DDDD | ... | 3 |
137505
+ * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
137506
+ * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
137507
+ * | | EEEEE | M, T, W, T, F, S, S | |
137508
+ * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
137509
+ * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
137510
+ * | | io | 1st, 2nd, ..., 7th | 7 |
137511
+ * | | ii | 01, 02, ..., 07 | 7 |
137512
+ * | | iii | Mon, Tue, Wed, ..., Sun | 7 |
137513
+ * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
137514
+ * | | iiiii | M, T, W, T, F, S, S | 7 |
137515
+ * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
137516
+ * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
137517
+ * | | eo | 2nd, 3rd, ..., 1st | 7 |
137518
+ * | | ee | 02, 03, ..., 01 | |
137519
+ * | | eee | Mon, Tue, Wed, ..., Sun | |
137520
+ * | | eeee | Monday, Tuesday, ..., Sunday | 2 |
137521
+ * | | eeeee | M, T, W, T, F, S, S | |
137522
+ * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
137523
+ * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
137524
+ * | | co | 2nd, 3rd, ..., 1st | 7 |
137525
+ * | | cc | 02, 03, ..., 01 | |
137526
+ * | | ccc | Mon, Tue, Wed, ..., Sun | |
137527
+ * | | cccc | Monday, Tuesday, ..., Sunday | 2 |
137528
+ * | | ccccc | M, T, W, T, F, S, S | |
137529
+ * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
137530
+ * | AM, PM | a..aa | AM, PM | |
137531
+ * | | aaa | am, pm | |
137532
+ * | | aaaa | a.m., p.m. | 2 |
137533
+ * | | aaaaa | a, p | |
137534
+ * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
137535
+ * | | bbb | am, pm, noon, midnight | |
137536
+ * | | bbbb | a.m., p.m., noon, midnight | 2 |
137537
+ * | | bbbbb | a, p, n, mi | |
137538
+ * | Flexible day period | B..BBB | at night, in the morning, ... | |
137539
+ * | | BBBB | at night, in the morning, ... | 2 |
137540
+ * | | BBBBB | at night, in the morning, ... | |
137541
+ * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
137542
+ * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
137543
+ * | | hh | 01, 02, ..., 11, 12 | |
137544
+ * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
137545
+ * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
137546
+ * | | HH | 00, 01, 02, ..., 23 | |
137547
+ * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
137548
+ * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
137549
+ * | | KK | 01, 02, ..., 11, 00 | |
137550
+ * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
137551
+ * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
137552
+ * | | kk | 24, 01, 02, ..., 23 | |
137553
+ * | Minute | m | 0, 1, ..., 59 | |
137554
+ * | | mo | 0th, 1st, ..., 59th | 7 |
137555
+ * | | mm | 00, 01, ..., 59 | |
137556
+ * | Second | s | 0, 1, ..., 59 | |
137557
+ * | | so | 0th, 1st, ..., 59th | 7 |
137558
+ * | | ss | 00, 01, ..., 59 | |
137559
+ * | Fraction of second | S | 0, 1, ..., 9 | |
137560
+ * | | SS | 00, 01, ..., 99 | |
137561
+ * | | SSS | 000, 001, ..., 999 | |
137562
+ * | | SSSS | ... | 3 |
137563
+ * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
137564
+ * | | XX | -0800, +0530, Z | |
137565
+ * | | XXX | -08:00, +05:30, Z | |
137566
+ * | | XXXX | -0800, +0530, Z, +123456 | 2 |
137567
+ * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
137568
+ * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
137569
+ * | | xx | -0800, +0530, +0000 | |
137570
+ * | | xxx | -08:00, +05:30, +00:00 | 2 |
137571
+ * | | xxxx | -0800, +0530, +0000, +123456 | |
137572
+ * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
137573
+ * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
137574
+ * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
137575
+ * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |
137576
+ * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |
137577
+ * | Seconds timestamp | t | 512969520 | 7 |
137578
+ * | | tt | ... | 3,7 |
137579
+ * | Milliseconds timestamp | T | 512969520900 | 7 |
137580
+ * | | TT | ... | 3,7 |
137581
+ * | Long localized date | P | 04/29/1453 | 7 |
137582
+ * | | PP | Apr 29, 1453 | 7 |
137583
+ * | | PPP | April 29th, 1453 | 7 |
137584
+ * | | PPPP | Friday, April 29th, 1453 | 2,7 |
137585
+ * | Long localized time | p | 12:00 AM | 7 |
137586
+ * | | pp | 12:00:00 AM | 7 |
137587
+ * | | ppp | 12:00:00 AM GMT+2 | 7 |
137588
+ * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
137589
+ * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
137590
+ * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
137591
+ * | | PPPppp | April 29th, 1453 at ... | 7 |
137592
+ * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
137593
+ * Notes:
137594
+ * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
137595
+ * are the same as "stand-alone" units, but are different in some languages.
137596
+ * "Formatting" units are declined according to the rules of the language
137597
+ * in the context of a date. "Stand-alone" units are always nominative singular:
137598
+ *
137599
+ * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
137600
+ *
137601
+ * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
137602
+ *
137603
+ * 2. Any sequence of the identical letters is a pattern, unless it is escaped by
137604
+ * the single quote characters (see below).
137605
+ * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
137606
+ * the output will be the same as default pattern for this unit, usually
137607
+ * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
137608
+ * are marked with "2" in the last column of the table.
137609
+ *
137610
+ * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
137611
+ *
137612
+ * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
137613
+ *
137614
+ * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
137615
+ *
137616
+ * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
137617
+ *
137618
+ * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
137619
+ *
137620
+ * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
137621
+ * The output will be padded with zeros to match the length of the pattern.
137622
+ *
137623
+ * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
137624
+ *
137625
+ * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
137626
+ * These tokens represent the shortest form of the quarter.
137627
+ *
137628
+ * 5. The main difference between `y` and `u` patterns are B.C. years:
137629
+ *
137630
+ * | Year | `y` | `u` |
137631
+ * |------|-----|-----|
137632
+ * | AC 1 | 1 | 1 |
137633
+ * | BC 1 | 1 | 0 |
137634
+ * | BC 2 | 2 | -1 |
137635
+ *
137636
+ * Also `yy` always returns the last two digits of a year,
137637
+ * while `uu` pads single digit years to 2 characters and returns other years unchanged:
137638
+ *
137639
+ * | Year | `yy` | `uu` |
137640
+ * |------|------|------|
137641
+ * | 1 | 01 | 01 |
137642
+ * | 14 | 14 | 14 |
137643
+ * | 376 | 76 | 376 |
137644
+ * | 1453 | 53 | 1453 |
137645
+ *
137646
+ * The same difference is true for local and ISO week-numbering years (`Y` and `R`),
137647
+ * except local week-numbering years are dependent on `options.weekStartsOn`
137648
+ * and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}
137649
+ * and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).
137650
+ *
137651
+ * 6. Specific non-location timezones are currently unavailable in `date-fns`,
137652
+ * so right now these tokens fall back to GMT timezones.
137653
+ *
137654
+ * 7. These patterns are not in the Unicode Technical Standard #35:
137655
+ * - `i`: ISO day of week
137656
+ * - `I`: ISO week of year
137657
+ * - `R`: ISO week-numbering year
137658
+ * - `t`: seconds timestamp
137659
+ * - `T`: milliseconds timestamp
137660
+ * - `o`: ordinal number modifier
137661
+ * - `P`: long localized date
137662
+ * - `p`: long localized time
137663
+ *
137664
+ * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
137665
+ * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://git.io/fxCyr
137666
+ *
137667
+ * 9. `D` and `DD` tokens represent days of the year but they are ofthen confused with days of the month.
137668
+ * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://git.io/fxCyr
137669
+ *
137670
+ * ### v2.0.0 breaking changes:
137671
+ *
137672
+ * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
137673
+ *
137674
+ * - The second argument is now required for the sake of explicitness.
137675
+ *
137676
+ * ```javascript
137677
+ * // Before v2.0.0
137678
+ * format(new Date(2016, 0, 1))
137679
+ *
137680
+ * // v2.0.0 onward
137681
+ * format(new Date(2016, 0, 1), "yyyy-MM-dd'T'HH:mm:ss.SSSxxx")
137682
+ * ```
137683
+ *
137684
+ * - New format string API for `format` function
137685
+ * which is based on [Unicode Technical Standard #35](https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table).
137686
+ * See [this post](https://blog.date-fns.org/post/unicode-tokens-in-date-fns-v2-sreatyki91jg) for more details.
137687
+ *
137688
+ * - Characters are now escaped using single quote symbols (`'`) instead of square brackets.
137689
+ *
137690
+ * @param {Date|Number} date - the original date
137691
+ * @param {String} format - the string of tokens
137692
+ * @param {Object} [options] - an object with options.
137693
+ * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
137694
+ * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
137695
+ * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
137696
+ * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;
137697
+ * see: https://git.io/fxCyr
137698
+ * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;
137699
+ * see: https://git.io/fxCyr
137700
+ * @returns {String} the formatted date string
137701
+ * @throws {TypeError} 2 arguments required
137702
+ * @throws {RangeError} `date` must not be Invalid Date
137703
+ * @throws {RangeError} `options.locale` must contain `localize` property
137704
+ * @throws {RangeError} `options.locale` must contain `formatLong` property
137705
+ * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
137706
+ * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
137707
+ * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr
137708
+ * @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr
137709
+ * @throws {RangeError} use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://git.io/fxCyr
137710
+ * @throws {RangeError} use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://git.io/fxCyr
137711
+ * @throws {RangeError} format string contains an unescaped latin alphabet character
137712
+ *
137713
+ * @example
137714
+ * // Represent 11 February 2014 in middle-endian format:
137715
+ * var result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
137716
+ * //=> '02/11/2014'
137717
+ *
137718
+ * @example
137719
+ * // Represent 2 July 2014 in Esperanto:
137720
+ * import { eoLocale } from 'date-fns/locale/eo'
137721
+ * var result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
137722
+ * locale: eoLocale
137723
+ * })
137724
+ * //=> '2-a de julio 2014'
137725
+ *
137726
+ * @example
137727
+ * // Escape string by single quote characters:
137728
+ * var result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
137729
+ * //=> "3 o'clock"
137730
+ */
137731
+
137732
+ function format(dirtyDate, dirtyFormatStr, dirtyOptions) {
137733
+ requiredArgs(2, arguments);
137734
+ var formatStr = String(dirtyFormatStr);
137735
+ var options = dirtyOptions || {};
137736
+ var locale = options.locale || defaultLocale;
137737
+ var localeFirstWeekContainsDate = locale.options && locale.options.firstWeekContainsDate;
137738
+ var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
137739
+ var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
137740
+
137741
+ if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
137742
+ throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
137743
+ }
137744
+
137745
+ var localeWeekStartsOn = locale.options && locale.options.weekStartsOn;
137746
+ var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
137747
+ var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
137748
+
137749
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
137750
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
137751
+ }
137752
+
137753
+ if (!locale.localize) {
137754
+ throw new RangeError('locale must contain localize property');
137755
+ }
137756
+
137757
+ if (!locale.formatLong) {
137758
+ throw new RangeError('locale must contain formatLong property');
137759
+ }
137760
+
137761
+ var originalDate = toDate(dirtyDate);
137762
+
137763
+ if (!isValid(originalDate)) {
137764
+ throw new RangeError('Invalid time value');
137765
+ } // Convert the date in system timezone to the same date in UTC+00:00 timezone.
137766
+ // This ensures that when UTC functions will be implemented, locales will be compatible with them.
137767
+ // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
137768
+
137769
+
137770
+ var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
137771
+ var utcDate = subMilliseconds(originalDate, timezoneOffset);
137772
+ var formatterOptions = {
137773
+ firstWeekContainsDate: firstWeekContainsDate,
137774
+ weekStartsOn: weekStartsOn,
137775
+ locale: locale,
137776
+ _originalDate: originalDate
137777
+ };
137778
+ var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) {
137779
+ var firstCharacter = substring[0];
137780
+
137781
+ if (firstCharacter === 'p' || firstCharacter === 'P') {
137782
+ var longFormatter = longFormatters$1[firstCharacter];
137783
+ return longFormatter(substring, locale.formatLong, formatterOptions);
137784
+ }
137785
+
137786
+ return substring;
137787
+ }).join('').match(formattingTokensRegExp).map(function (substring) {
137788
+ // Replace two single quote characters with one single quote character
137789
+ if (substring === "''") {
137790
+ return "'";
137791
+ }
137792
+
137793
+ var firstCharacter = substring[0];
137794
+
137795
+ if (firstCharacter === "'") {
137796
+ return cleanEscapedString(substring);
137797
+ }
137798
+
137799
+ var formatter = formatters$1[firstCharacter];
137800
+
137801
+ if (formatter) {
137802
+ if (!options.useAdditionalWeekYearTokens && isProtectedWeekYearToken(substring)) {
137803
+ throwProtectedError(substring, dirtyFormatStr, dirtyDate);
137804
+ }
137805
+
137806
+ if (!options.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(substring)) {
137807
+ throwProtectedError(substring, dirtyFormatStr, dirtyDate);
137808
+ }
137809
+
137810
+ return formatter(utcDate, substring, locale.localize, formatterOptions);
137811
+ }
137812
+
137813
+ if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
137814
+ throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');
137815
+ }
137816
+
137817
+ return substring;
137818
+ }).join('');
137819
+ return result;
137820
+ }
137821
+
137822
+ function cleanEscapedString(input) {
137823
+ return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'");
137824
+ }
137825
+
135474
137826
  var PublishingDateFilter = function PublishingDateFilter() {
135475
137827
  var publishingDateRef = React$d.useRef();
135476
137828
  var formatMessage = useIntl().formatMessage;
@@ -135486,6 +137838,7 @@
135486
137838
  var today = new Date();
135487
137839
  var startOfToday = startOfDay(today);
135488
137840
  var endOfToday = endOfDay(today);
137841
+ var isActive = (filter === null || filter === void 0 ? void 0 : filter.beforeDate) || (filter === null || filter === void 0 ? void 0 : filter.afterDate);
135489
137842
  return jsxRuntime.jsxs("div", __assign$g({
135490
137843
  ref: publishingDateRef
135491
137844
  }, {
@@ -135493,13 +137846,13 @@
135493
137846
  iconProps: {
135494
137847
  iconName: showDates ? 'ChevronUp' : 'ChevronDown'
135495
137848
  },
135496
- text: formatMessage({
137849
+ text: isActive ? getButtonText() : formatMessage({
135497
137850
  id: 'FilterPanel.publishingDate'
135498
137851
  }),
135499
137852
  onClick: function () {
135500
137853
  return setShowDates(!showDates);
135501
137854
  },
135502
- isActive: (filter === null || filter === void 0 ? void 0 : filter.beforeDate) || (filter === null || filter === void 0 ? void 0 : filter.afterDate)
137855
+ isActive: isActive
135503
137856
  }, void 0), showDates && jsxRuntime.jsx(Callout, __assign$g({
135504
137857
  target: publishingDateRef.current,
135505
137858
  onDismiss: function () {
@@ -135533,8 +137886,7 @@
135533
137886
  noDateResourceKey: "MetadataEditor.noDate",
135534
137887
  selectDateResourceKey: "FilterPanel.publishingDatePlaceholder",
135535
137888
  onChanged: handleEndDateChange,
135536
- minDate: filter === null || filter === void 0 ? void 0 : filter.afterDate,
135537
- maxDate: today.toString()
137889
+ minDate: filter === null || filter === void 0 ? void 0 : filter.afterDate
135538
137890
  }, void 0), jsxRuntime.jsxs(DateShortcuts, {
135539
137891
  children: [jsxRuntime.jsx(FormattedMessage$1, {
135540
137892
  id: "FilterPanel.publishingDateShortcuts"
@@ -135608,6 +137960,25 @@
135608
137960
  afterDate: null
135609
137961
  }));
135610
137962
  }
137963
+
137964
+ function getButtonText() {
137965
+ var start = format(new Date(filter.afterDate), 'P');
137966
+ var end = format(new Date(filter.beforeDate), 'P');
137967
+
137968
+ if (!filter.afterDate) {
137969
+ return formatMessage({
137970
+ id: 'FilterPanel.publishingDateBefore'
137971
+ }) + " " + end;
137972
+ }
137973
+
137974
+ if (!filter.beforeDate) {
137975
+ return formatMessage({
137976
+ id: 'FilterPanel.publishingDateAfter'
137977
+ }) + " " + start;
137978
+ }
137979
+
137980
+ return start + " - " + end;
137981
+ }
135611
137982
  };
135612
137983
 
135613
137984
  var DateShortcutButton = function DateShortcutButton(_a) {
@@ -152581,6 +154952,8 @@
152581
154952
  "FilterPanel.publishingDate": "Publishing date",
152582
154953
  "FilterPanel.publishingDateFrom": "From",
152583
154954
  "FilterPanel.publishingDateTo": "To",
154955
+ "FilterPanel.publishingDateBefore": "Before",
154956
+ "FilterPanel.publishingDateAfter": "After",
152584
154957
  "FilterPanel.publishingDatePlaceholder": "Date",
152585
154958
  "FilterPanel.publishingDateShortcuts": "Date range shortcuts",
152586
154959
  "FilterPanel.publishingDateShortcuts.yesterday": "Yesterday",