@nulogy/components 8.7.3 → 8.8.1

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/dist/main.js CHANGED
@@ -23038,20 +23038,42 @@
23038
23038
  }
23039
23039
  };
23040
23040
 
23041
- var showIndicatorSeparator = function showIndicatorSeparator(_ref3) {
23042
- var isMulti = _ref3.isMulti,
23043
- hasValue = _ref3.hasValue,
23044
- hasDefaultOptions = _ref3.hasDefaultOptions;
23041
+ function getControlBorderRadius(_ref3) {
23042
+ var border = _ref3.border,
23043
+ isMenuOpen = _ref3.isMenuOpen,
23044
+ menuLength = _ref3.menuLength,
23045
+ menuPlacement = _ref3.menuPlacement,
23046
+ theme = _ref3.theme;
23047
+ var isMenuEmpty = menuLength === 0;
23048
+ if (!isMenuOpen || isMenuEmpty || border !== menuPlacement) return theme.radii.medium;
23049
+ return 0;
23050
+ }
23051
+ function getMenuBorderRadius(_ref4) {
23052
+ var border = _ref4.border,
23053
+ menuPlacement = _ref4.menuPlacement,
23054
+ theme = _ref4.theme;
23055
+ return border === menuPlacement ? {
23056
+ radius: theme.radii.medium,
23057
+ style: "solid"
23058
+ } : {
23059
+ radius: 0,
23060
+ style: "none"
23061
+ };
23062
+ }
23063
+ var showIndicatorSeparator = function showIndicatorSeparator(_ref5) {
23064
+ var isMulti = _ref5.isMulti,
23065
+ hasValue = _ref5.hasValue,
23066
+ hasDefaultOptions = _ref5.hasDefaultOptions;
23045
23067
  return isMulti && hasValue && hasDefaultOptions;
23046
23068
  };
23047
23069
 
23048
- var customStyles = function customStyles(_ref4) {
23049
- var theme = _ref4.theme,
23050
- error = _ref4.error,
23051
- maxHeight = _ref4.maxHeight,
23052
- windowed = _ref4.windowed,
23053
- _ref4$hasDefaultOptio = _ref4.hasDefaultOptions,
23054
- hasDefaultOptions = _ref4$hasDefaultOptio === void 0 ? true : _ref4$hasDefaultOptio;
23070
+ var customStyles = function customStyles(_ref6) {
23071
+ var theme = _ref6.theme,
23072
+ error = _ref6.error,
23073
+ maxHeight = _ref6.maxHeight,
23074
+ windowed = _ref6.windowed,
23075
+ _ref6$hasDefaultOptio = _ref6.hasDefaultOptions,
23076
+ hasDefaultOptions = _ref6$hasDefaultOptio === void 0 ? true : _ref6$hasDefaultOptio;
23055
23077
  return {
23056
23078
  option: function option() {
23057
23079
  return {
@@ -23084,8 +23106,34 @@
23084
23106
  theme: theme
23085
23107
  }),
23086
23108
  borderRadius: theme.radii.medium,
23087
- borderBottomLeftRadius: state.selectProps.menuIsOpen && state.selectProps.options.length ? 0 : theme.radii.medium,
23088
- borderBottomRightRadius: state.selectProps.menuIsOpen && state.selectProps.options.length ? 0 : theme.radii.medium,
23109
+ borderBottomLeftRadius: getControlBorderRadius({
23110
+ border: "bottom",
23111
+ isMenuOpen: state.selectProps.menuIsOpen,
23112
+ menuLength: state.selectProps.options.length,
23113
+ menuPlacement: state.selectProps.menuPlacement,
23114
+ theme: theme
23115
+ }),
23116
+ borderBottomRightRadius: getControlBorderRadius({
23117
+ border: "bottom",
23118
+ isMenuOpen: state.selectProps.menuIsOpen,
23119
+ menuLength: state.selectProps.options.length,
23120
+ menuPlacement: state.selectProps.menuPlacement,
23121
+ theme: theme
23122
+ }),
23123
+ borderTopRightRadius: getControlBorderRadius({
23124
+ border: "top",
23125
+ isMenuOpen: state.selectProps.menuIsOpen,
23126
+ menuLength: state.selectProps.options.length,
23127
+ menuPlacement: state.selectProps.menuPlacement,
23128
+ theme: theme
23129
+ }),
23130
+ borderTopLeftRadius: getControlBorderRadius({
23131
+ border: "top",
23132
+ isMenuOpen: state.selectProps.menuIsOpen,
23133
+ menuLength: state.selectProps.options.length,
23134
+ menuPlacement: state.selectProps.menuPlacement,
23135
+ theme: theme
23136
+ }),
23089
23137
  "&:hover, &:focus": {
23090
23138
  borderColor: getBorderColor({
23091
23139
  errored: error,
@@ -23120,8 +23168,9 @@
23120
23168
  });
23121
23169
  },
23122
23170
  menu: function menu(provided, state) {
23123
- return {
23171
+ return Object.assign(Object.assign({}, provided), {
23124
23172
  marginTop: 0,
23173
+ marginBottom: 0,
23125
23174
  position: "absolute",
23126
23175
  overflowX: "auto",
23127
23176
  zIndex: "100",
@@ -23135,16 +23184,44 @@
23135
23184
  isFocused: false,
23136
23185
  theme: theme
23137
23186
  }),
23138
- borderBottomStyle: "solid",
23139
23187
  borderLeftStyle: "solid",
23140
23188
  borderRightStyle: "solid",
23141
- borderRadius: "0 0 4px 4px",
23189
+ borderBottomStyle: getMenuBorderRadius({
23190
+ border: "bottom",
23191
+ menuPlacement: state.selectProps.menuPlacement,
23192
+ theme: theme
23193
+ }).style,
23194
+ borderTopStyle: getMenuBorderRadius({
23195
+ border: "top",
23196
+ menuPlacement: state.selectProps.menuPlacement,
23197
+ theme: theme
23198
+ }).style,
23199
+ borderBottomLeftRadius: getMenuBorderRadius({
23200
+ border: "bottom",
23201
+ menuPlacement: state.selectProps.menuPlacement,
23202
+ theme: theme
23203
+ }).radius,
23204
+ borderBottomRightRadius: getMenuBorderRadius({
23205
+ border: "bottom",
23206
+ menuPlacement: state.selectProps.menuPlacement,
23207
+ theme: theme
23208
+ }).radius,
23209
+ borderTopLeftRadius: getMenuBorderRadius({
23210
+ border: "top",
23211
+ menuPlacement: state.selectProps.menuPlacement,
23212
+ theme: theme
23213
+ }).radius,
23214
+ borderTopRightRadius: getMenuBorderRadius({
23215
+ border: "top",
23216
+ menuPlacement: state.selectProps.menuPlacement,
23217
+ theme: theme
23218
+ }).radius,
23142
23219
  boxShadow: getShadow({
23143
23220
  errored: error,
23144
23221
  isOpen: true,
23145
23222
  theme: theme
23146
23223
  })
23147
- };
23224
+ });
23148
23225
  },
23149
23226
  menuList: function menuList(provided) {
23150
23227
  return Object.assign(Object.assign({}, provided), {
@@ -23274,6 +23351,7 @@
23274
23351
  initialIsOpen: undefined,
23275
23352
  maxHeight: "248px",
23276
23353
  menuPosition: "absolute",
23354
+ menuPlacement: "bottom",
23277
23355
  multiselect: false,
23278
23356
  name: undefined,
23279
23357
  onBlur: undefined,
@@ -27690,7 +27768,7 @@
27690
27768
 
27691
27769
  function requiredArgs$1(required, args) {
27692
27770
  if (args.length < required) {
27693
- throw new TypeError(required + ' argument' + required > 1 ? 's' : '' + ' required, but only ' + args.length + ' present');
27771
+ throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
27694
27772
  }
27695
27773
  }
27696
27774
 
@@ -27737,7 +27815,7 @@
27737
27815
  } else {
27738
27816
  if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
27739
27817
  // eslint-disable-next-line no-console
27740
- console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"); // eslint-disable-next-line no-console
27818
+ console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"); // eslint-disable-next-line no-console
27741
27819
 
27742
27820
  console.warn(new Error().stack);
27743
27821
  }
@@ -27759,13 +27837,13 @@
27759
27837
  * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
27760
27838
  *
27761
27839
  * @param {Date|Number} date - the date to be changed
27762
- * @param {Number} amount - the amount of days to be added
27763
- * @returns {Date} the new date with the days added
27764
- * @throws {TypeError} 2 arguments required
27840
+ * @param {Number} amount - the amount of days to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
27841
+ * @returns {Date} - the new date with the days added
27842
+ * @throws {TypeError} - 2 arguments required
27765
27843
  *
27766
27844
  * @example
27767
27845
  * // Add 10 days to 1 September 2014:
27768
- * var result = addDays(new Date(2014, 8, 1), 10)
27846
+ * const result = addDays(new Date(2014, 8, 1), 10)
27769
27847
  * //=> Thu Sep 11 2014 00:00:00
27770
27848
  */
27771
27849
 
@@ -27773,6 +27851,16 @@
27773
27851
  requiredArgs$1(2, arguments);
27774
27852
  var date = toDate$1(dirtyDate);
27775
27853
  var amount = toInteger$1(dirtyAmount);
27854
+
27855
+ if (isNaN(amount)) {
27856
+ return new Date(NaN);
27857
+ }
27858
+
27859
+ if (!amount) {
27860
+ // If 0 days, no-op to avoid changing times in the hour before end of DST
27861
+ return date;
27862
+ }
27863
+
27776
27864
  date.setDate(date.getDate() + amount);
27777
27865
  return date;
27778
27866
  }
@@ -27790,13 +27878,13 @@
27790
27878
  * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
27791
27879
  *
27792
27880
  * @param {Date|Number} date - the date to be changed
27793
- * @param {Number} amount - the amount of milliseconds to be added
27881
+ * @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`.
27794
27882
  * @returns {Date} the new date with the milliseconds added
27795
27883
  * @throws {TypeError} 2 arguments required
27796
27884
  *
27797
27885
  * @example
27798
27886
  * // Add 750 milliseconds to 10 July 2014 12:45:30.000:
27799
- * var result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
27887
+ * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
27800
27888
  * //=> Thu Jul 10 2014 12:45:30.750
27801
27889
  */
27802
27890
 
@@ -27807,7 +27895,6 @@
27807
27895
  return new Date(timestamp + amount);
27808
27896
  }
27809
27897
 
27810
- var MILLISECONDS_IN_MINUTE$3 = 60000;
27811
27898
  /**
27812
27899
  * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
27813
27900
  * They usually appear for dates that denote time before the timezones were introduced
@@ -27819,13 +27906,10 @@
27819
27906
  *
27820
27907
  * This function returns the timezone offset in milliseconds that takes seconds in account.
27821
27908
  */
27822
-
27823
- function getTimezoneOffsetInMilliseconds$1(dirtyDate) {
27824
- var date = new Date(dirtyDate.getTime());
27825
- var baseTimezoneOffset = Math.ceil(date.getTimezoneOffset());
27826
- date.setSeconds(0, 0);
27827
- var millisecondsPartOfTimezoneOffset = date.getTime() % MILLISECONDS_IN_MINUTE$3;
27828
- return baseTimezoneOffset * MILLISECONDS_IN_MINUTE$3 + millisecondsPartOfTimezoneOffset;
27909
+ function getTimezoneOffsetInMilliseconds$1(date) {
27910
+ var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
27911
+ utcDate.setUTCFullYear(date.getFullYear());
27912
+ return date.getTime() - utcDate.getTime();
27829
27913
  }
27830
27914
 
27831
27915
  /**
@@ -27847,7 +27931,7 @@
27847
27931
  *
27848
27932
  * @example
27849
27933
  * // The start of a day for 2 September 2014 11:55:00:
27850
- * var result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
27934
+ * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
27851
27935
  * //=> Tue Sep 02 2014 00:00:00
27852
27936
  */
27853
27937
 
@@ -27880,14 +27964,14 @@
27880
27964
  * @example
27881
27965
  * // How many calendar days are between
27882
27966
  * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?
27883
- * var result = differenceInCalendarDays(
27967
+ * const result = differenceInCalendarDays(
27884
27968
  * new Date(2012, 6, 2, 0, 0),
27885
27969
  * new Date(2011, 6, 2, 23, 0)
27886
27970
  * )
27887
27971
  * //=> 366
27888
27972
  * // How many calendar days are between
27889
27973
  * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?
27890
- * var result = differenceInCalendarDays(
27974
+ * const result = differenceInCalendarDays(
27891
27975
  * new Date(2011, 6, 3, 0, 1),
27892
27976
  * new Date(2011, 6, 2, 23, 59)
27893
27977
  * )
@@ -27906,58 +27990,6 @@
27906
27990
  return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_DAY$3);
27907
27991
  }
27908
27992
 
27909
- /**
27910
- * @name compareAsc
27911
- * @category Common Helpers
27912
- * @summary Compare the two dates and return -1, 0 or 1.
27913
- *
27914
- * @description
27915
- * Compare the two dates and return 1 if the first date is after the second,
27916
- * -1 if the first date is before the second or 0 if dates are equal.
27917
- *
27918
- * ### v2.0.0 breaking changes:
27919
- *
27920
- * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
27921
- *
27922
- * @param {Date|Number} dateLeft - the first date to compare
27923
- * @param {Date|Number} dateRight - the second date to compare
27924
- * @returns {Number} the result of the comparison
27925
- * @throws {TypeError} 2 arguments required
27926
- *
27927
- * @example
27928
- * // Compare 11 February 1987 and 10 July 1989:
27929
- * var result = compareAsc(new Date(1987, 1, 11), new Date(1989, 6, 10))
27930
- * //=> -1
27931
- *
27932
- * @example
27933
- * // Sort the array of dates:
27934
- * var result = [
27935
- * new Date(1995, 6, 2),
27936
- * new Date(1987, 1, 11),
27937
- * new Date(1989, 6, 10)
27938
- * ].sort(compareAsc)
27939
- * //=> [
27940
- * // Wed Feb 11 1987 00:00:00,
27941
- * // Mon Jul 10 1989 00:00:00,
27942
- * // Sun Jul 02 1995 00:00:00
27943
- * // ]
27944
- */
27945
-
27946
- function compareAsc(dirtyDateLeft, dirtyDateRight) {
27947
- requiredArgs$1(2, arguments);
27948
- var dateLeft = toDate$1(dirtyDateLeft);
27949
- var dateRight = toDate$1(dirtyDateRight);
27950
- var diff = dateLeft.getTime() - dateRight.getTime();
27951
-
27952
- if (diff < 0) {
27953
- return -1;
27954
- } else if (diff > 0) {
27955
- return 1; // Return 0 if diff is 0; return NaN if diff is NaN
27956
- } else {
27957
- return diff;
27958
- }
27959
- }
27960
-
27961
27993
  /**
27962
27994
  * @name isValid
27963
27995
  * @category Common Helpers
@@ -28052,13 +28084,37 @@
28052
28084
  return dateLeftStartOfDay.getTime() === dateRightStartOfDay.getTime();
28053
28085
  }
28054
28086
 
28087
+ // for accurate equality comparisons of UTC timestamps that end up
28088
+ // having the same representation in local time, e.g. one hour before
28089
+ // DST ends vs. the instant that DST ends.
28090
+
28091
+ function compareLocalAsc(dateLeft, dateRight) {
28092
+ var diff = dateLeft.getFullYear() - dateRight.getFullYear() || dateLeft.getMonth() - dateRight.getMonth() || dateLeft.getDate() - dateRight.getDate() || dateLeft.getHours() - dateRight.getHours() || dateLeft.getMinutes() - dateRight.getMinutes() || dateLeft.getSeconds() - dateRight.getSeconds() || dateLeft.getMilliseconds() - dateRight.getMilliseconds();
28093
+
28094
+ if (diff < 0) {
28095
+ return -1;
28096
+ } else if (diff > 0) {
28097
+ return 1; // Return 0 if diff is 0; return NaN if diff is NaN
28098
+ } else {
28099
+ return diff;
28100
+ }
28101
+ }
28055
28102
  /**
28056
28103
  * @name differenceInDays
28057
28104
  * @category Day Helpers
28058
28105
  * @summary Get the number of full days between the given dates.
28059
28106
  *
28060
28107
  * @description
28061
- * Get the number of full day periods between the given dates.
28108
+ * Get the number of full day periods between two dates. Fractional days are
28109
+ * truncated towards zero.
28110
+ *
28111
+ * One "full day" is the distance between a local time in one day to the same
28112
+ * local time on the next or previous day. A full day can sometimes be less than
28113
+ * or more than 24 hours if a daylight savings change happens between two dates.
28114
+ *
28115
+ * To ignore DST and only measure exact 24-hour periods, use this instead:
28116
+ * `Math.floor(differenceInHours(dateLeft, dateRight)/24)|0`.
28117
+ *
28062
28118
  *
28063
28119
  * ### v2.0.0 breaking changes:
28064
28120
  *
@@ -28066,36 +28122,48 @@
28066
28122
  *
28067
28123
  * @param {Date|Number} dateLeft - the later date
28068
28124
  * @param {Date|Number} dateRight - the earlier date
28069
- * @returns {Number} the number of full days
28125
+ * @returns {Number} the number of full days according to the local timezone
28070
28126
  * @throws {TypeError} 2 arguments required
28071
28127
  *
28072
28128
  * @example
28073
28129
  * // How many full days are between
28074
28130
  * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?
28075
- * var result = differenceInDays(
28131
+ * const result = differenceInDays(
28076
28132
  * new Date(2012, 6, 2, 0, 0),
28077
28133
  * new Date(2011, 6, 2, 23, 0)
28078
28134
  * )
28079
28135
  * //=> 365
28080
- * // How many days are between
28136
+ * // How many full days are between
28081
28137
  * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?
28082
- * var result = differenceInDays(
28138
+ * const result = differenceInDays(
28083
28139
  * new Date(2011, 6, 3, 0, 1),
28084
28140
  * new Date(2011, 6, 2, 23, 59)
28085
28141
  * )
28086
28142
  * //=> 0
28143
+ * // How many full days are between
28144
+ * // 1 March 2020 0:00 and 1 June 2020 0:00 ?
28145
+ * // Note: because local time is used, the
28146
+ * // result will always be 92 days, even in
28147
+ * // time zones where DST starts and the
28148
+ * // period has only 92*24-1 hours.
28149
+ * const result = differenceInDays(
28150
+ * new Date(2020, 5, 1),
28151
+ * new Date(2020, 2, 1)
28152
+ * )
28153
+ //=> 92
28087
28154
  */
28088
28155
 
28156
+
28089
28157
  function differenceInDays(dirtyDateLeft, dirtyDateRight) {
28090
28158
  requiredArgs$1(2, arguments);
28091
28159
  var dateLeft = toDate$1(dirtyDateLeft);
28092
28160
  var dateRight = toDate$1(dirtyDateRight);
28093
- var sign = compareAsc(dateLeft, dateRight);
28161
+ var sign = compareLocalAsc(dateLeft, dateRight);
28094
28162
  var difference = Math.abs(differenceInCalendarDays$1(dateLeft, dateRight));
28095
28163
  dateLeft.setDate(dateLeft.getDate() - sign * difference); // Math.abs(diff in full days - diff in calendar days) === 1 if last calendar day is not full
28096
28164
  // If so, result must be decreased by 1 in absolute value
28097
28165
 
28098
- var isLastDayNotFull = compareAsc(dateLeft, dateRight) === -sign;
28166
+ var isLastDayNotFull = Number(compareLocalAsc(dateLeft, dateRight) === -sign);
28099
28167
  var result = sign * (difference - isLastDayNotFull); // Prevent negative zero
28100
28168
 
28101
28169
  return result === 0 ? 0 : result;
@@ -28131,6 +28199,14 @@
28131
28199
  one: '1 day',
28132
28200
  other: '{{count}} days'
28133
28201
  },
28202
+ aboutXWeeks: {
28203
+ one: 'about 1 week',
28204
+ other: 'about {{count}} weeks'
28205
+ },
28206
+ xWeeks: {
28207
+ one: '1 week',
28208
+ other: '{{count}} weeks'
28209
+ },
28134
28210
  aboutXMonths: {
28135
28211
  one: 'about 1 month',
28136
28212
  other: 'about {{count}} months'
@@ -28180,8 +28256,9 @@
28180
28256
  }
28181
28257
 
28182
28258
  function buildFormatLongFn$1(args) {
28183
- return function (dirtyOptions) {
28184
- var options = dirtyOptions || {};
28259
+ return function () {
28260
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
28261
+ // TODO: Remove String()
28185
28262
  var width = options.width ? String(options.width) : args.defaultWidth;
28186
28263
  var format = args.formats[width] || args.formats[args.defaultWidth];
28187
28264
  return format;
@@ -28251,7 +28328,8 @@
28251
28328
  valuesArray = args.values[_width] || args.values[_defaultWidth];
28252
28329
  }
28253
28330
 
28254
- var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
28331
+ 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!
28332
+
28255
28333
  return valuesArray[index];
28256
28334
  };
28257
28335
  }
@@ -28264,12 +28342,12 @@
28264
28342
  var quarterValues$9 = {
28265
28343
  narrow: ['1', '2', '3', '4'],
28266
28344
  abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
28267
- wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter'] // Note: in English, the names of days of the week and months are capitalized.
28268
- // If you are making a new locale based on this one, check if the same is true for the language you're working on.
28269
- // Generally, formatted dates should look like they are in the middle of a sentence,
28270
- // e.g. in Spanish language the weekdays and months should be in the lowercase.
28345
+ wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
28346
+ }; // Note: in English, the names of days of the week and months are capitalized.
28347
+ // If you are making a new locale based on this one, check if the same is true for the language you're working on.
28348
+ // Generally, formatted dates should look like they are in the middle of a sentence,
28349
+ // e.g. in Spanish language the weekdays and months should be in the lowercase.
28271
28350
 
28272
- };
28273
28351
  var monthValues$9 = {
28274
28352
  narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
28275
28353
  abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
@@ -28405,35 +28483,26 @@
28405
28483
  };
28406
28484
 
28407
28485
  function buildMatchPatternFn$1(args) {
28408
- return function (dirtyString, dirtyOptions) {
28409
- var string = String(dirtyString);
28410
- var options = dirtyOptions || {};
28486
+ return function (string) {
28487
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
28411
28488
  var matchResult = string.match(args.matchPattern);
28412
-
28413
- if (!matchResult) {
28414
- return null;
28415
- }
28416
-
28489
+ if (!matchResult) return null;
28417
28490
  var matchedString = matchResult[0];
28418
28491
  var parseResult = string.match(args.parsePattern);
28419
-
28420
- if (!parseResult) {
28421
- return null;
28422
- }
28423
-
28492
+ if (!parseResult) return null;
28424
28493
  var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
28425
28494
  value = options.valueCallback ? options.valueCallback(value) : value;
28495
+ var rest = string.slice(matchedString.length);
28426
28496
  return {
28427
28497
  value: value,
28428
- rest: string.slice(matchedString.length)
28498
+ rest: rest
28429
28499
  };
28430
28500
  };
28431
28501
  }
28432
28502
 
28433
28503
  function buildMatchFn$1(args) {
28434
- return function (dirtyString, dirtyOptions) {
28435
- var string = String(dirtyString);
28436
- var options = dirtyOptions || {};
28504
+ return function (string) {
28505
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
28437
28506
  var width = options.width;
28438
28507
  var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
28439
28508
  var matchResult = string.match(matchPattern);
@@ -28444,23 +28513,18 @@
28444
28513
 
28445
28514
  var matchedString = matchResult[0];
28446
28515
  var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
28516
+ var key = Array.isArray(parsePatterns) ? findIndex$1(parsePatterns, function (pattern) {
28517
+ return pattern.test(matchedString);
28518
+ }) : findKey$1(parsePatterns, function (pattern) {
28519
+ return pattern.test(matchedString);
28520
+ });
28447
28521
  var value;
28448
-
28449
- if (Object.prototype.toString.call(parsePatterns) === '[object Array]') {
28450
- value = findIndex$1(parsePatterns, function (pattern) {
28451
- return pattern.test(string);
28452
- });
28453
- } else {
28454
- value = findKey$1(parsePatterns, function (pattern) {
28455
- return pattern.test(string);
28456
- });
28457
- }
28458
-
28459
- value = args.valueCallback ? args.valueCallback(value) : value;
28522
+ value = args.valueCallback ? args.valueCallback(key) : key;
28460
28523
  value = options.valueCallback ? options.valueCallback(value) : value;
28524
+ var rest = string.slice(matchedString.length);
28461
28525
  return {
28462
28526
  value: value,
28463
- rest: string.slice(matchedString.length)
28527
+ rest: rest
28464
28528
  };
28465
28529
  };
28466
28530
  }
@@ -28471,6 +28535,8 @@
28471
28535
  return key;
28472
28536
  }
28473
28537
  }
28538
+
28539
+ return undefined;
28474
28540
  }
28475
28541
 
28476
28542
  function findIndex$1(array, predicate) {
@@ -28479,6 +28545,8 @@
28479
28545
  return key;
28480
28546
  }
28481
28547
  }
28548
+
28549
+ return undefined;
28482
28550
  }
28483
28551
 
28484
28552
  var matchOrdinalNumberPattern$9 = /^(\d+)(th|st|nd|rd)?/i;
@@ -28615,13 +28683,13 @@
28615
28683
  * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
28616
28684
  *
28617
28685
  * @param {Date|Number} date - the date to be changed
28618
- * @param {Number} amount - the amount of milliseconds to be subtracted
28686
+ * @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`.
28619
28687
  * @returns {Date} the new date with the milliseconds subtracted
28620
28688
  * @throws {TypeError} 2 arguments required
28621
28689
  *
28622
28690
  * @example
28623
28691
  * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
28624
- * var result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
28692
+ * const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
28625
28693
  * //=> Thu Jul 10 2014 12:45:29.250
28626
28694
  */
28627
28695
 
@@ -28687,9 +28755,11 @@
28687
28755
  switch (token) {
28688
28756
  case 'a':
28689
28757
  case 'aa':
28690
- case 'aaa':
28691
28758
  return dayPeriodEnumValue.toUpperCase();
28692
28759
 
28760
+ case 'aaa':
28761
+ return dayPeriodEnumValue;
28762
+
28693
28763
  case 'aaaaa':
28694
28764
  return dayPeriodEnumValue[0];
28695
28765
 
@@ -28894,53 +28964,53 @@
28894
28964
  afternoon: 'afternoon',
28895
28965
  evening: 'evening',
28896
28966
  night: 'night'
28897
- /*
28898
- * | | Unit | | Unit |
28899
- * |-----|--------------------------------|-----|--------------------------------|
28900
- * | a | AM, PM | A* | Milliseconds in day |
28901
- * | b | AM, PM, noon, midnight | B | Flexible day period |
28902
- * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
28903
- * | d | Day of month | D | Day of year |
28904
- * | e | Local day of week | E | Day of week |
28905
- * | f | | F* | Day of week in month |
28906
- * | g* | Modified Julian day | G | Era |
28907
- * | h | Hour [1-12] | H | Hour [0-23] |
28908
- * | i! | ISO day of week | I! | ISO week of year |
28909
- * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
28910
- * | k | Hour [1-24] | K | Hour [0-11] |
28911
- * | l* | (deprecated) | L | Stand-alone month |
28912
- * | m | Minute | M | Month |
28913
- * | n | | N | |
28914
- * | o! | Ordinal number modifier | O | Timezone (GMT) |
28915
- * | p! | Long localized time | P! | Long localized date |
28916
- * | q | Stand-alone quarter | Q | Quarter |
28917
- * | r* | Related Gregorian year | R! | ISO week-numbering year |
28918
- * | s | Second | S | Fraction of second |
28919
- * | t! | Seconds timestamp | T! | Milliseconds timestamp |
28920
- * | u | Extended year | U* | Cyclic year |
28921
- * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
28922
- * | w | Local week of year | W* | Week of month |
28923
- * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
28924
- * | y | Year (abs) | Y | Local week-numbering year |
28925
- * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
28926
- *
28927
- * Letters marked by * are not implemented but reserved by Unicode standard.
28928
- *
28929
- * Letters marked by ! are non-standard, but implemented by date-fns:
28930
- * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
28931
- * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
28932
- * i.e. 7 for Sunday, 1 for Monday, etc.
28933
- * - `I` is ISO week of year, as opposed to `w` which is local week of year.
28934
- * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
28935
- * `R` is supposed to be used in conjunction with `I` and `i`
28936
- * for universal ISO week-numbering date, whereas
28937
- * `Y` is supposed to be used in conjunction with `w` and `e`
28938
- * for week-numbering date specific to the locale.
28939
- * - `P` is long localized date format
28940
- * - `p` is long localized time format
28941
- */
28942
-
28943
28967
  };
28968
+ /*
28969
+ * | | Unit | | Unit |
28970
+ * |-----|--------------------------------|-----|--------------------------------|
28971
+ * | a | AM, PM | A* | Milliseconds in day |
28972
+ * | b | AM, PM, noon, midnight | B | Flexible day period |
28973
+ * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
28974
+ * | d | Day of month | D | Day of year |
28975
+ * | e | Local day of week | E | Day of week |
28976
+ * | f | | F* | Day of week in month |
28977
+ * | g* | Modified Julian day | G | Era |
28978
+ * | h | Hour [1-12] | H | Hour [0-23] |
28979
+ * | i! | ISO day of week | I! | ISO week of year |
28980
+ * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
28981
+ * | k | Hour [1-24] | K | Hour [0-11] |
28982
+ * | l* | (deprecated) | L | Stand-alone month |
28983
+ * | m | Minute | M | Month |
28984
+ * | n | | N | |
28985
+ * | o! | Ordinal number modifier | O | Timezone (GMT) |
28986
+ * | p! | Long localized time | P! | Long localized date |
28987
+ * | q | Stand-alone quarter | Q | Quarter |
28988
+ * | r* | Related Gregorian year | R! | ISO week-numbering year |
28989
+ * | s | Second | S | Fraction of second |
28990
+ * | t! | Seconds timestamp | T! | Milliseconds timestamp |
28991
+ * | u | Extended year | U* | Cyclic year |
28992
+ * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
28993
+ * | w | Local week of year | W* | Week of month |
28994
+ * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
28995
+ * | y | Year (abs) | Y | Local week-numbering year |
28996
+ * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
28997
+ *
28998
+ * Letters marked by * are not implemented but reserved by Unicode standard.
28999
+ *
29000
+ * Letters marked by ! are non-standard, but implemented by date-fns:
29001
+ * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
29002
+ * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
29003
+ * i.e. 7 for Sunday, 1 for Monday, etc.
29004
+ * - `I` is ISO week of year, as opposed to `w` which is local week of year.
29005
+ * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
29006
+ * `R` is supposed to be used in conjunction with `I` and `i`
29007
+ * for universal ISO week-numbering date, whereas
29008
+ * `Y` is supposed to be used in conjunction with `w` and `e`
29009
+ * for week-numbering date specific to the locale.
29010
+ * - `P` is long localized date format
29011
+ * - `p` is long localized time format
29012
+ */
29013
+
28944
29014
  var formatters$2 = {
28945
29015
  // Era
28946
29016
  G: function (date, token, localize) {
@@ -29426,12 +29496,17 @@
29426
29496
  switch (token) {
29427
29497
  case 'a':
29428
29498
  case 'aa':
29429
- case 'aaa':
29430
29499
  return localize.dayPeriod(dayPeriodEnumValue, {
29431
29500
  width: 'abbreviated',
29432
29501
  context: 'formatting'
29433
29502
  });
29434
29503
 
29504
+ case 'aaa':
29505
+ return localize.dayPeriod(dayPeriodEnumValue, {
29506
+ width: 'abbreviated',
29507
+ context: 'formatting'
29508
+ }).toLowerCase();
29509
+
29435
29510
  case 'aaaaa':
29436
29511
  return localize.dayPeriod(dayPeriodEnumValue, {
29437
29512
  width: 'narrow',
@@ -29462,12 +29537,17 @@
29462
29537
  switch (token) {
29463
29538
  case 'b':
29464
29539
  case 'bb':
29465
- case 'bbb':
29466
29540
  return localize.dayPeriod(dayPeriodEnumValue, {
29467
29541
  width: 'abbreviated',
29468
29542
  context: 'formatting'
29469
29543
  });
29470
29544
 
29545
+ case 'bbb':
29546
+ return localize.dayPeriod(dayPeriodEnumValue, {
29547
+ width: 'abbreviated',
29548
+ context: 'formatting'
29549
+ }).toLowerCase();
29550
+
29471
29551
  case 'bbbbb':
29472
29552
  return localize.dayPeriod(dayPeriodEnumValue, {
29473
29553
  width: 'narrow',
@@ -29837,15 +29917,15 @@
29837
29917
  function isProtectedWeekYearToken$1(token) {
29838
29918
  return protectedWeekYearTokens$1.indexOf(token) !== -1;
29839
29919
  }
29840
- function throwProtectedError$1(token) {
29920
+ function throwProtectedError$1(token, format, input) {
29841
29921
  if (token === 'YYYY') {
29842
- throw new RangeError('Use `yyyy` instead of `YYYY` for formatting years; see: https://git.io/fxCyr');
29922
+ throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
29843
29923
  } else if (token === 'YY') {
29844
- throw new RangeError('Use `yy` instead of `YY` for formatting years; see: https://git.io/fxCyr');
29924
+ throw new RangeError("Use `yy` instead of `YY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
29845
29925
  } else if (token === 'D') {
29846
- throw new RangeError('Use `d` instead of `D` for formatting days of the month; see: https://git.io/fxCyr');
29926
+ 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"));
29847
29927
  } else if (token === 'DD') {
29848
- throw new RangeError('Use `dd` instead of `DD` for formatting days of the month; see: https://git.io/fxCyr');
29928
+ 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"));
29849
29929
  }
29850
29930
  }
29851
29931
 
@@ -29952,35 +30032,37 @@
29952
30032
  * | | DD | 01, 02, ..., 365, 366 | 9 |
29953
30033
  * | | DDD | 001, 002, ..., 365, 366 | |
29954
30034
  * | | DDDD | ... | 3 |
29955
- * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Su | |
30035
+ * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
29956
30036
  * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
29957
30037
  * | | EEEEE | M, T, W, T, F, S, S | |
29958
30038
  * | | EEEEEE | Mo, Tu, We, Th, Fr, Su, Sa | |
29959
30039
  * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
29960
30040
  * | | io | 1st, 2nd, ..., 7th | 7 |
29961
30041
  * | | ii | 01, 02, ..., 07 | 7 |
29962
- * | | iii | Mon, Tue, Wed, ..., Su | 7 |
30042
+ * | | iii | Mon, Tue, Wed, ..., Sun | 7 |
29963
30043
  * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
29964
30044
  * | | iiiii | M, T, W, T, F, S, S | 7 |
29965
30045
  * | | iiiiii | Mo, Tu, We, Th, Fr, Su, Sa | 7 |
29966
30046
  * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
29967
30047
  * | | eo | 2nd, 3rd, ..., 1st | 7 |
29968
30048
  * | | ee | 02, 03, ..., 01 | |
29969
- * | | eee | Mon, Tue, Wed, ..., Su | |
30049
+ * | | eee | Mon, Tue, Wed, ..., Sun | |
29970
30050
  * | | eeee | Monday, Tuesday, ..., Sunday | 2 |
29971
30051
  * | | eeeee | M, T, W, T, F, S, S | |
29972
30052
  * | | eeeeee | Mo, Tu, We, Th, Fr, Su, Sa | |
29973
30053
  * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
29974
30054
  * | | co | 2nd, 3rd, ..., 1st | 7 |
29975
30055
  * | | cc | 02, 03, ..., 01 | |
29976
- * | | ccc | Mon, Tue, Wed, ..., Su | |
30056
+ * | | ccc | Mon, Tue, Wed, ..., Sun | |
29977
30057
  * | | cccc | Monday, Tuesday, ..., Sunday | 2 |
29978
30058
  * | | ccccc | M, T, W, T, F, S, S | |
29979
30059
  * | | cccccc | Mo, Tu, We, Th, Fr, Su, Sa | |
29980
- * | AM, PM | a..aaa | AM, PM | |
30060
+ * | AM, PM | a..aa | AM, PM | |
30061
+ * | | aaa | am, pm | |
29981
30062
  * | | aaaa | a.m., p.m. | 2 |
29982
30063
  * | | aaaaa | a, p | |
29983
- * | AM, PM, noon, midnight | b..bbb | AM, PM, noon, midnight | |
30064
+ * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
30065
+ * | | bbb | am, pm, noon, midnight | |
29984
30066
  * | | bbbb | a.m., p.m., noon, midnight | 2 |
29985
30067
  * | | bbbbb | a, p, n, mi | |
29986
30068
  * | Flexible day period | B..BBB | at night, in the morning, ... | |
@@ -29994,7 +30076,7 @@
29994
30076
  * | | HH | 00, 01, 02, ..., 23 | |
29995
30077
  * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
29996
30078
  * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
29997
- * | | KK | 1, 2, ..., 11, 0 | |
30079
+ * | | KK | 01, 02, ..., 11, 00 | |
29998
30080
  * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
29999
30081
  * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
30000
30082
  * | | kk | 24, 01, 02, ..., 23 | |
@@ -30006,7 +30088,7 @@
30006
30088
  * | | ss | 00, 01, ..., 59 | |
30007
30089
  * | Fraction of second | S | 0, 1, ..., 9 | |
30008
30090
  * | | SS | 00, 01, ..., 99 | |
30009
- * | | SSS | 000, 0001, ..., 999 | |
30091
+ * | | SSS | 000, 001, ..., 999 | |
30010
30092
  * | | SSSS | ... | 3 |
30011
30093
  * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
30012
30094
  * | | XX | -0800, +0530, Z | |
@@ -30026,18 +30108,18 @@
30026
30108
  * | | tt | ... | 3,7 |
30027
30109
  * | Milliseconds timestamp | T | 512969520900 | 7 |
30028
30110
  * | | TT | ... | 3,7 |
30029
- * | Long localized date | P | 05/29/1453 | 7 |
30030
- * | | PP | May 29, 1453 | 7 |
30031
- * | | PPP | May 29th, 1453 | 7 |
30032
- * | | PPPP | Sunday, May 29th, 1453 | 2,7 |
30111
+ * | Long localized date | P | 04/29/1453 | 7 |
30112
+ * | | PP | Apr 29, 1453 | 7 |
30113
+ * | | PPP | April 29th, 1453 | 7 |
30114
+ * | | PPPP | Friday, April 29th, 1453 | 2,7 |
30033
30115
  * | Long localized time | p | 12:00 AM | 7 |
30034
30116
  * | | pp | 12:00:00 AM | 7 |
30035
30117
  * | | ppp | 12:00:00 AM GMT+2 | 7 |
30036
30118
  * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
30037
- * | Combination of date and time | Pp | 05/29/1453, 12:00 AM | 7 |
30038
- * | | PPpp | May 29, 1453, 12:00:00 AM | 7 |
30039
- * | | PPPppp | May 29th, 1453 at ... | 7 |
30040
- * | | PPPPpppp| Sunday, May 29th, 1453 at ... | 2,7 |
30119
+ * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
30120
+ * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
30121
+ * | | PPPppp | April 29th, 1453 at ... | 7 |
30122
+ * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
30041
30123
  * Notes:
30042
30124
  * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
30043
30125
  * are the same as "stand-alone" units, but are different in some languages.
@@ -30152,10 +30234,10 @@
30152
30234
  * @throws {RangeError} `options.locale` must contain `formatLong` property
30153
30235
  * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
30154
30236
  * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
30155
- * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years; see: https://git.io/fxCyr
30156
- * @throws {RangeError} use `yy` instead of `YY` for formatting years; see: https://git.io/fxCyr
30157
- * @throws {RangeError} use `d` instead of `D` for formatting days of the month; see: https://git.io/fxCyr
30158
- * @throws {RangeError} use `dd` instead of `DD` for formatting days of the month; see: https://git.io/fxCyr
30237
+ * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr
30238
+ * @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr
30239
+ * @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
30240
+ * @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
30159
30241
  * @throws {RangeError} format string contains an unescaped latin alphabet character
30160
30242
  *
30161
30243
  * @example
@@ -30248,11 +30330,11 @@
30248
30330
 
30249
30331
  if (formatter) {
30250
30332
  if (!options.useAdditionalWeekYearTokens && isProtectedWeekYearToken$1(substring)) {
30251
- throwProtectedError$1(substring);
30333
+ throwProtectedError$1(substring, dirtyFormatStr, dirtyDate);
30252
30334
  }
30253
30335
 
30254
30336
  if (!options.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken$1(substring)) {
30255
- throwProtectedError$1(substring);
30337
+ throwProtectedError$1(substring, dirtyFormatStr, dirtyDate);
30256
30338
  }
30257
30339
 
30258
30340
  return formatter(utcDate, substring, locale.localize, formatterOptions);
@@ -30271,6 +30353,35 @@
30271
30353
  return input.match(escapedStringRegExp$2)[1].replace(doubleQuoteRegExp$2, "'");
30272
30354
  }
30273
30355
 
30356
+ /**
30357
+ * @name subDays
30358
+ * @category Day Helpers
30359
+ * @summary Subtract the specified number of days from the given date.
30360
+ *
30361
+ * @description
30362
+ * Subtract the specified number of days from the given date.
30363
+ *
30364
+ * ### v2.0.0 breaking changes:
30365
+ *
30366
+ * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
30367
+ *
30368
+ * @param {Date|Number} date - the date to be changed
30369
+ * @param {Number} amount - the amount of days to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
30370
+ * @returns {Date} the new date with the days subtracted
30371
+ * @throws {TypeError} 2 arguments required
30372
+ *
30373
+ * @example
30374
+ * // Subtract 10 days from 1 September 2014:
30375
+ * const result = subDays(new Date(2014, 8, 1), 10)
30376
+ * //=> Fri Aug 22 2014 00:00:00
30377
+ */
30378
+
30379
+ function subDays$1(dirtyDate, dirtyAmount) {
30380
+ requiredArgs$1(2, arguments);
30381
+ var amount = toInteger$1(dirtyAmount);
30382
+ return addDays$1(dirtyDate, -amount);
30383
+ }
30384
+
30274
30385
  /**
30275
30386
  * @name isAfter
30276
30387
  * @category Common Helpers
@@ -30331,35 +30442,6 @@
30331
30442
  return date.getTime() < dateToCompare.getTime();
30332
30443
  }
30333
30444
 
30334
- /**
30335
- * @name subDays
30336
- * @category Day Helpers
30337
- * @summary Subtract the specified number of days from the given date.
30338
- *
30339
- * @description
30340
- * Subtract the specified number of days from the given date.
30341
- *
30342
- * ### v2.0.0 breaking changes:
30343
- *
30344
- * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
30345
- *
30346
- * @param {Date|Number} date - the date to be changed
30347
- * @param {Number} amount - the amount of days to be subtracted
30348
- * @returns {Date} the new date with the days subtracted
30349
- * @throws {TypeError} 2 arguments required
30350
- *
30351
- * @example
30352
- * // Subtract 10 days from 1 September 2014:
30353
- * var result = subDays(new Date(2014, 8, 1), 10)
30354
- * //=> Fri Aug 22 2014 00:00:00
30355
- */
30356
-
30357
- function subDays$1(dirtyDate, dirtyAmount) {
30358
- requiredArgs$1(2, arguments);
30359
- var amount = toInteger$1(dirtyAmount);
30360
- return addDays$1(dirtyDate, -amount);
30361
- }
30362
-
30363
30445
  /**
30364
30446
  * @name setMinutes
30365
30447
  * @category Minute Helpers
@@ -30379,7 +30461,7 @@
30379
30461
  *
30380
30462
  * @example
30381
30463
  * // Set 45 minutes to 1 September 2014 11:30:40:
30382
- * var result = setMinutes(new Date(2014, 8, 1, 11, 30, 40), 45)
30464
+ * const result = setMinutes(new Date(2014, 8, 1, 11, 30, 40), 45)
30383
30465
  * //=> Mon Sep 01 2014 11:45:40
30384
30466
  */
30385
30467
 
@@ -37706,6 +37788,26 @@
37706
37788
  other: '{{count}} Tagen'
37707
37789
  }
37708
37790
  },
37791
+ aboutXWeeks: {
37792
+ standalone: {
37793
+ one: 'etwa ein Woche',
37794
+ other: 'etwa {{count}} Wochen'
37795
+ },
37796
+ withPreposition: {
37797
+ one: 'etwa einem Woche',
37798
+ other: 'etwa {{count}} Wochen'
37799
+ }
37800
+ },
37801
+ xWeeks: {
37802
+ standalone: {
37803
+ one: 'ein Woche',
37804
+ other: '{{count}} Wochen'
37805
+ },
37806
+ withPreposition: {
37807
+ one: 'einem Woche',
37808
+ other: '{{count}} Wochen'
37809
+ }
37810
+ },
37709
37811
  aboutXMonths: {
37710
37812
  standalone: {
37711
37813
  one: 'etwa ein Monat',
@@ -37767,7 +37869,8 @@
37767
37869
  }
37768
37870
  }
37769
37871
  };
37770
- function formatDistance$7(token, count, options) {
37872
+
37873
+ var formatDistance$7 = function (token, count, options) {
37771
37874
  options = options || {};
37772
37875
  var usageGroup = options.addSuffix ? formatDistanceLocale$7[token].withPreposition : formatDistanceLocale$7[token].standalone;
37773
37876
  var result;
@@ -37777,11 +37880,11 @@
37777
37880
  } else if (count === 1) {
37778
37881
  result = usageGroup.one;
37779
37882
  } else {
37780
- result = usageGroup.other.replace('{{count}}', count);
37883
+ result = usageGroup.other.replace('{{count}}', String(count));
37781
37884
  }
37782
37885
 
37783
37886
  if (options.addSuffix) {
37784
- if (options.comparison > 0) {
37887
+ if (options.comparison && options.comparison > 0) {
37785
37888
  return 'in ' + result;
37786
37889
  } else {
37787
37890
  return 'vor ' + result;
@@ -37789,14 +37892,15 @@
37789
37892
  }
37790
37893
 
37791
37894
  return result;
37792
- }
37895
+ };
37793
37896
 
37897
+ // DIN 5008: https://de.wikipedia.org/wiki/Datumsformat#DIN_5008
37794
37898
  var dateFormats$7 = {
37795
37899
  full: 'EEEE, do MMMM y',
37796
37900
  // Montag, 7. Januar 2018
37797
37901
  long: 'do MMMM y',
37798
37902
  // 7. Januar 2018
37799
- medium: 'do MMM. y',
37903
+ medium: 'do MMM y',
37800
37904
  // 7. Jan. 2018
37801
37905
  short: 'dd.MM.y' // 07.01.2018
37802
37906
 
@@ -37836,9 +37940,10 @@
37836
37940
  nextWeek: "eeee 'um' p",
37837
37941
  other: 'P'
37838
37942
  };
37839
- function formatRelative$7(token, _date, _baseDate, _options) {
37943
+
37944
+ var formatRelative$7 = function (token, _date, _baseDate, _options) {
37840
37945
  return formatRelativeLocale$7[token];
37841
- }
37946
+ };
37842
37947
 
37843
37948
  var eraValues$7 = {
37844
37949
  narrow: ['v.Chr.', 'n.Chr.'],
@@ -37848,24 +37953,24 @@
37848
37953
  var quarterValues$7 = {
37849
37954
  narrow: ['1', '2', '3', '4'],
37850
37955
  abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
37851
- wide: ['1. Quartal', '2. Quartal', '3. Quartal', '4. Quartal'] // Note: in German, the names of days of the week and months are capitalized.
37852
- // If you are making a new locale based on this one, check if the same is true for the language you're working on.
37853
- // Generally, formatted dates should look like they are in the middle of a sentence,
37854
- // e.g. in Spanish language the weekdays and months should be in the lowercase.
37956
+ wide: ['1. Quartal', '2. Quartal', '3. Quartal', '4. Quartal']
37957
+ }; // Note: in German, the names of days of the week and months are capitalized.
37958
+ // If you are making a new locale based on this one, check if the same is true for the language you're working on.
37959
+ // Generally, formatted dates should look like they are in the middle of a sentence,
37960
+ // e.g. in Spanish language the weekdays and months should be in the lowercase.
37855
37961
 
37856
- };
37857
37962
  var monthValues$7 = {
37858
37963
  narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
37859
- abbreviated: ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'],
37964
+ abbreviated: ['Jan.', 'Feb.', 'März', 'Apr.', 'Mai', 'Juni', 'Juli', 'Aug.', 'Sep.', 'Okt.', 'Nov.', 'Dez.'],
37860
37965
  wide: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember']
37861
37966
  };
37862
37967
  var dayValues$7 = {
37863
37968
  narrow: ['S', 'M', 'D', 'M', 'D', 'F', 'S'],
37864
37969
  short: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
37865
37970
  abbreviated: ['So.', 'Mo.', 'Di.', 'Mi.', 'Do.', 'Fr.', 'Sa.'],
37866
- wide: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'] // https://www.unicode.org/cldr/charts/32/summary/de.html#1881
37971
+ wide: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag']
37972
+ }; // https://www.unicode.org/cldr/charts/32/summary/de.html#1881
37867
37973
 
37868
- };
37869
37974
  var dayPeriodValues$7 = {
37870
37975
  narrow: {
37871
37976
  am: 'vm.',
@@ -37931,10 +38036,10 @@
37931
38036
  }
37932
38037
  };
37933
38038
 
37934
- function ordinalNumber$7(dirtyNumber, _dirtyOptions) {
38039
+ var ordinalNumber$7 = function (dirtyNumber, _dirtyOptions) {
37935
38040
  var number = Number(dirtyNumber);
37936
38041
  return number + '.';
37937
- }
38042
+ };
37938
38043
 
37939
38044
  var localize$7 = {
37940
38045
  ordinalNumber: ordinalNumber$7,
@@ -37946,7 +38051,7 @@
37946
38051
  values: quarterValues$7,
37947
38052
  defaultWidth: 'wide',
37948
38053
  argumentCallback: function (quarter) {
37949
- return Number(quarter) - 1;
38054
+ return quarter - 1;
37950
38055
  }
37951
38056
  }),
37952
38057
  month: buildLocalizeFn$1({
@@ -38025,7 +38130,7 @@
38025
38130
  matchPattern: matchOrdinalNumberPattern$7,
38026
38131
  parsePattern: parseOrdinalNumberPattern$7,
38027
38132
  valueCallback: function (value) {
38028
- return parseInt(value, 10);
38133
+ return parseInt(value);
38029
38134
  }
38030
38135
  }),
38031
38136
  era: buildMatchFn$1({
@@ -38075,7 +38180,6 @@
38075
38180
  * @author RomanErnst [@pex]{@link https://github.com/pex}
38076
38181
  * @author Philipp Keck [@Philipp91]{@link https://github.com/Philipp91}
38077
38182
  */
38078
-
38079
38183
  var locale$7 = {
38080
38184
  code: 'de',
38081
38185
  formatDistance: formatDistance$7,
@@ -38121,6 +38225,14 @@
38121
38225
  one: '1 día',
38122
38226
  other: '{{count}} días'
38123
38227
  },
38228
+ aboutXWeeks: {
38229
+ one: 'alrededor de 1 semana',
38230
+ other: 'alrededor de {{count}} semanas'
38231
+ },
38232
+ xWeeks: {
38233
+ one: '1 semana',
38234
+ other: '{{count}} semanas'
38235
+ },
38124
38236
  aboutXMonths: {
38125
38237
  one: 'alrededor de 1 mes',
38126
38238
  other: 'alrededor de {{count}} meses'
@@ -38170,8 +38282,8 @@
38170
38282
  }
38171
38283
 
38172
38284
  var dateFormats$6 = {
38173
- full: "EEEE, d 'de' MMMM y",
38174
- long: "d 'de' MMMM y",
38285
+ full: "EEEE, d 'de' MMMM 'de' y",
38286
+ long: "d 'de' MMMM 'de' y",
38175
38287
  medium: 'd MMM y',
38176
38288
  short: 'dd/MM/y'
38177
38289
  };
@@ -38244,7 +38356,7 @@
38244
38356
  var dayValues$6 = {
38245
38357
  narrow: ['d', 'l', 'm', 'm', 'j', 'v', 's'],
38246
38358
  short: ['do', 'lu', 'ma', 'mi', 'ju', 'vi', 'sa'],
38247
- abbreviated: ['dom', 'lun', 'mar', 'mié', 'jue', 'vie', 'sab'],
38359
+ abbreviated: ['dom', 'lun', 'mar', 'mié', 'jue', 'vie', 'sáb'],
38248
38360
  wide: ['domingo', 'lunes', 'martes', 'miércoles', 'jueves', 'viernes', 'sábado']
38249
38361
  };
38250
38362
  var dayPeriodValues$6 = {
@@ -38378,7 +38490,7 @@
38378
38490
  narrow: /^[dlmjvs]/i,
38379
38491
  short: /^(do|lu|ma|mi|ju|vi|sa)/i,
38380
38492
  abbreviated: /^(dom|lun|mar|mie|jue|vie|sab)/i,
38381
- wide: /^(domingo|lunes|martes|miercoles|jueves|viernes|s[áa]bado)/i
38493
+ wide: /^(domingo|lunes|martes|mi[ée]rcoles|jueves|viernes|s[áa]bado)/i
38382
38494
  };
38383
38495
  var parseDayPatterns$6 = {
38384
38496
  narrow: [/^d/i, /^l/i, /^m/i, /^m/i, /^j/i, /^v/i, /^s/i],
@@ -38501,6 +38613,14 @@
38501
38613
  one: '1 jour',
38502
38614
  other: '{{count}} jours'
38503
38615
  },
38616
+ aboutXWeeks: {
38617
+ one: 'environ 1 semaine',
38618
+ other: 'environ {{count}} semaines'
38619
+ },
38620
+ xWeeks: {
38621
+ one: '1 semaine',
38622
+ other: '{{count}} semaines'
38623
+ },
38504
38624
  aboutXMonths: {
38505
38625
  one: 'environ 1 mois',
38506
38626
  other: 'environ {{count}} mois'
@@ -38819,7 +38939,7 @@
38819
38939
  weekStartsOn: 1
38820
38940
  /* Monday */
38821
38941
  ,
38822
- firstWeekContainsDate: 1
38942
+ firstWeekContainsDate: 4
38823
38943
  }
38824
38944
  };
38825
38945
 
@@ -38853,6 +38973,14 @@
38853
38973
  one: '1 dag',
38854
38974
  other: '{{count}} dagen'
38855
38975
  },
38976
+ aboutXWeeks: {
38977
+ one: 'ongeveer 1 week',
38978
+ other: 'ongeveer {{count}} weken'
38979
+ },
38980
+ xWeeks: {
38981
+ one: '1 week',
38982
+ other: '{{count}} weken'
38983
+ },
38856
38984
  aboutXMonths: {
38857
38985
  one: 'ongeveer 1 maand',
38858
38986
  other: 'ongeveer {{count}} maanden'
@@ -38958,7 +39086,7 @@
38958
39086
  };
38959
39087
  var monthValues$4 = {
38960
39088
  narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
38961
- abbreviated: ['jan.', 'feb.', 'mrt.', 'apr.', 'mei.', 'jun.', 'jul.', 'aug.', 'sep.', 'okt.', 'nov.', 'dec.'],
39089
+ abbreviated: ['jan.', 'feb.', 'mrt.', 'apr.', 'mei', 'jun.', 'jul.', 'aug.', 'sep.', 'okt.', 'nov.', 'dec.'],
38962
39090
  wide: ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december']
38963
39091
  };
38964
39092
  var dayValues$4 = {
@@ -38973,30 +39101,30 @@
38973
39101
  pm: 'PM',
38974
39102
  midnight: 'middernacht',
38975
39103
  noon: 'het middaguur',
38976
- morning: '\'s ochtends',
38977
- afternoon: '\'s middags',
38978
- evening: '\'s avonds',
38979
- night: '\'s nachts'
39104
+ morning: "'s ochtends",
39105
+ afternoon: "'s middags",
39106
+ evening: "'s avonds",
39107
+ night: "'s nachts"
38980
39108
  },
38981
39109
  abbreviated: {
38982
39110
  am: 'AM',
38983
39111
  pm: 'PM',
38984
39112
  midnight: 'middernacht',
38985
39113
  noon: 'het middaguur',
38986
- morning: '\'s ochtends',
38987
- afternoon: '\'s middags',
38988
- evening: '\'s avonds',
38989
- night: '\'s nachts'
39114
+ morning: "'s ochtends",
39115
+ afternoon: "'s middags",
39116
+ evening: "'s avonds",
39117
+ night: "'s nachts"
38990
39118
  },
38991
39119
  wide: {
38992
39120
  am: 'AM',
38993
39121
  pm: 'PM',
38994
39122
  midnight: 'middernacht',
38995
39123
  noon: 'het middaguur',
38996
- morning: '\'s ochtends',
38997
- afternoon: '\'s middags',
38998
- evening: '\'s avonds',
38999
- night: '\'s nachts'
39124
+ morning: "'s ochtends",
39125
+ afternoon: "'s middags",
39126
+ evening: "'s avonds",
39127
+ night: "'s nachts"
39000
39128
  }
39001
39129
  };
39002
39130
 
@@ -39052,7 +39180,7 @@
39052
39180
  };
39053
39181
  var matchMonthPatterns$4 = {
39054
39182
  narrow: /^[jfmasond]/i,
39055
- abbreviated: /^(jan|feb|mrt|apr|mei|jun|jul|aug|sep|okt|nov|dec)\.?/i,
39183
+ abbreviated: /^(jan.|feb.|mrt.|apr.|mei|jun.|jul.|aug.|sep.|okt.|nov.|dec.)/i,
39056
39184
  wide: /^(januari|februari|maart|april|mei|juni|juli|augustus|september|oktober|november|december)/i
39057
39185
  };
39058
39186
  var parseMonthPatterns$4 = {
@@ -39227,7 +39355,7 @@
39227
39355
  },
39228
39356
  aboutXHours: {
39229
39357
  one: {
39230
- regular: 'około godzina',
39358
+ regular: 'około godziny',
39231
39359
  past: 'około godziny',
39232
39360
  future: 'około godzinę'
39233
39361
  },
@@ -39252,6 +39380,16 @@
39252
39380
  twoFour: '{{count}} dni',
39253
39381
  other: '{{count}} dni'
39254
39382
  },
39383
+ aboutXWeeks: {
39384
+ one: 'około tygodnia',
39385
+ twoFour: 'około {{count}} tygodni',
39386
+ other: 'około {{count}} tygodni'
39387
+ },
39388
+ xWeeks: {
39389
+ one: 'tydzień',
39390
+ twoFour: '{{count}} tygodnie',
39391
+ other: '{{count}} tygodni'
39392
+ },
39255
39393
  aboutXMonths: {
39256
39394
  one: 'około miesiąc',
39257
39395
  twoFour: 'około {{count}} miesiące',
@@ -39694,6 +39832,14 @@
39694
39832
  one: '1 dia',
39695
39833
  other: '{{count}} dias'
39696
39834
  },
39835
+ aboutXWeeks: {
39836
+ one: 'cerca de 1 semana',
39837
+ other: 'cerca de {{count}} semanas'
39838
+ },
39839
+ xWeeks: {
39840
+ one: '1 semana',
39841
+ other: '{{count}} semanas'
39842
+ },
39697
39843
  aboutXMonths: {
39698
39844
  one: 'cerca de 1 mês',
39699
39845
  other: 'cerca de {{count}} meses'
@@ -39813,10 +39959,10 @@
39813
39959
  wide: ['janeiro', 'fevereiro', 'março', 'abril', 'maio', 'junho', 'julho', 'agosto', 'setembro', 'outubro', 'novembro', 'dezembro']
39814
39960
  };
39815
39961
  var dayValues$2 = {
39816
- narrow: ['do', '', '', '', '', '', ''],
39817
- short: ['do', '', '', '', '', '', ''],
39818
- abbreviated: ['dom', 'seg', 'ter', 'qua', 'qui', 'sex', 'sáb'],
39819
- wide: ['domingo', 'segunda', 'terça', 'quarta', 'quinta', 'sexta', 'sábado']
39962
+ narrow: ['D', 'S', 'T', 'Q', 'Q', 'S', 'S'],
39963
+ short: ['dom', 'seg', 'ter', 'qua', 'qui', 'sex', 'sab'],
39964
+ abbreviated: ['domingo', 'segunda', 'terça', 'quarta', 'quinta', 'sexta', 'sábado'],
39965
+ wide: ['domingo', 'segunda-feira', 'terça-feira', 'quarta-feira', 'quinta-feira', 'sexta-feira', 'sábado']
39820
39966
  };
39821
39967
  var dayPeriodValues$2 = {
39822
39968
  narrow: {
@@ -40077,6 +40223,14 @@
40077
40223
  one: '1 zi',
40078
40224
  other: '{{count}} zile'
40079
40225
  },
40226
+ aboutXWeeks: {
40227
+ one: 'circa o săptămână',
40228
+ other: 'circa {{count}} săptămâni'
40229
+ },
40230
+ xWeeks: {
40231
+ one: '1 săptămână',
40232
+ other: '{{count}} săptămâni'
40233
+ },
40080
40234
  aboutXMonths: {
40081
40235
  one: 'circa 1 lună',
40082
40236
  other: 'circa {{count}} luni'
@@ -40443,6 +40597,14 @@
40443
40597
  one: '1 天',
40444
40598
  other: '{{count}} 天'
40445
40599
  },
40600
+ aboutXWeeks: {
40601
+ one: '大约 1 个星期',
40602
+ other: '大约 {{count}} 个星期'
40603
+ },
40604
+ xWeeks: {
40605
+ one: '1 个星期',
40606
+ other: '{{count}} 个星期'
40607
+ },
40446
40608
  aboutXMonths: {
40447
40609
  one: '大约 1 个月',
40448
40610
  other: '大约 {{count}} 个月'
@@ -40524,16 +40686,34 @@
40524
40686
  })
40525
40687
  };
40526
40688
 
40689
+ function checkWeek(_date, _baseDate, _options, baseFormat) {
40690
+ if (isSameUTCWeek(_date, _baseDate, _options)) {
40691
+ return baseFormat; // in same week
40692
+ } else if (_date.getTime() > _baseDate.getTime()) {
40693
+ return "'下个'" + baseFormat; // in next week
40694
+ }
40695
+
40696
+ return "'上个'" + baseFormat; // in last week
40697
+ }
40698
+
40527
40699
  var formatRelativeLocale = {
40528
- lastWeek: "'上个' eeee p",
40700
+ lastWeek: checkWeek,
40701
+ // days before yesterday, maybe in this week or last week
40529
40702
  yesterday: "'昨天' p",
40530
40703
  today: "'今天' p",
40531
40704
  tomorrow: "'明天' p",
40532
- nextWeek: "'下个' eeee p",
40533
- other: 'P'
40705
+ nextWeek: checkWeek,
40706
+ // days after tomorrow, maybe in this week or next week
40707
+ other: 'PP p'
40534
40708
  };
40535
40709
  function formatRelative(token, _date, _baseDate, _options) {
40536
- return formatRelativeLocale[token];
40710
+ var format = formatRelativeLocale[token];
40711
+
40712
+ if (typeof format === 'function') {
40713
+ return format(_date, _baseDate, _options, 'eeee p');
40714
+ }
40715
+
40716
+ return format;
40537
40717
  }
40538
40718
 
40539
40719
  var eraValues = {
@@ -40636,11 +40816,22 @@
40636
40816
  var options = dirtyOptions || {};
40637
40817
  var unit = String(options.unit);
40638
40818
 
40639
- if (unit === 'date' || unit === 'hour' || unit === 'minute' || unit === 'second') {
40640
- return number.toString();
40641
- }
40819
+ switch (unit) {
40820
+ case 'date':
40821
+ return number.toString() + '日';
40822
+
40823
+ case 'hour':
40824
+ return number.toString() + '时';
40825
+
40826
+ case 'minute':
40827
+ return number.toString() + '分';
40642
40828
 
40643
- return '' + number.toString();
40829
+ case 'second':
40830
+ return number.toString() + '秒';
40831
+
40832
+ default:
40833
+ return '第 ' + number.toString();
40834
+ }
40644
40835
  }
40645
40836
 
40646
40837
  var localize = {
@@ -40672,7 +40863,7 @@
40672
40863
  })
40673
40864
  };
40674
40865
 
40675
- var matchOrdinalNumberPattern = /^(第\s*)?\d+/i;
40866
+ var matchOrdinalNumberPattern = /^(第\s*)?\d+(日|时|分|秒)?/i;
40676
40867
  var parseOrdinalNumberPattern = /\d+/i;
40677
40868
  var matchEraPatterns = {
40678
40869
  narrow: /^(前)/i,
@@ -40697,7 +40888,7 @@
40697
40888
  };
40698
40889
  var parseMonthPatterns = {
40699
40890
  narrow: [/^一/i, /^二/i, /^三/i, /^四/i, /^五/i, /^六/i, /^七/i, /^八/i, /^九/i, /^十(?!(一|二))/i, /^十一/i, /^十二/i],
40700
- any: [/^一|[!\d]1[!\d]/i, /^二|[!\d]2[!\d]/i, /^三|3/i, /^四|4/i, /^五|5/i, /^六|6/i, /^七|7/i, /^八|8/i, /^九|9/i, /^十(?!(一|二))|10/i, /^十一|11/i, /^十二|12/i]
40891
+ any: [/^一|1/i, /^二|2/i, /^三|3/i, /^四|4/i, /^五|5/i, /^六|6/i, /^七|7/i, /^八|8/i, /^九|9/i, /^十(?!(一|二))|10/i, /^十一|11/i, /^十二|12/i]
40701
40892
  };
40702
40893
  var matchDayPatterns = {
40703
40894
  narrow: /^[一二三四五六日]/i,
@@ -40709,17 +40900,17 @@
40709
40900
  any: [/日/i, /一/i, /二/i, /三/i, /四/i, /五/i, /六/i]
40710
40901
  };
40711
40902
  var matchDayPeriodPatterns = {
40712
- any: /^(上午|下午|午夜|[中正]午|早上|下午|晚上?|凌晨)/i
40903
+ any: /^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i
40713
40904
  };
40714
40905
  var parseDayPeriodPatterns = {
40715
40906
  any: {
40716
- am: /^上午/i,
40717
- pm: /^下午/i,
40907
+ am: /^上午?/i,
40908
+ pm: /^下午?/i,
40718
40909
  midnight: /^午夜/i,
40719
40910
  noon: /^[中正]午/i,
40720
40911
  morning: /^早上/i,
40721
40912
  afternoon: /^下午/i,
40722
- evening: /^晚/i,
40913
+ evening: /^晚上?/i,
40723
40914
  night: /^凌晨/i
40724
40915
  }
40725
40916
  };
@@ -40776,6 +40967,7 @@
40776
40967
  * @author Song Shuoyun [@fnlctrl]{@link https://github.com/fnlctrl}
40777
40968
  * @author sabrinaM [@sabrinamiao]{@link https://github.com/sabrinamiao}
40778
40969
  * @author Carney Wu [@cubicwork]{@link https://github.com/cubicwork}
40970
+ * @author Terrence Lam [@skyuplam]{@link https://github.com/skyuplam}
40779
40971
  */
40780
40972
 
40781
40973
  var locale = {