@react-stately/datepicker 3.9.3 → 3.10.0

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.
Files changed (68) hide show
  1. package/dist/ar-AE.mjs +1 -1
  2. package/dist/bg-BG.mjs +1 -1
  3. package/dist/cs-CZ.mjs +1 -1
  4. package/dist/da-DK.mjs +1 -1
  5. package/dist/de-DE.mjs +1 -1
  6. package/dist/el-GR.mjs +1 -1
  7. package/dist/en-US.mjs +1 -1
  8. package/dist/es-ES.mjs +1 -1
  9. package/dist/et-EE.mjs +1 -1
  10. package/dist/fi-FI.mjs +1 -1
  11. package/dist/fr-FR.mjs +1 -1
  12. package/dist/he-IL.mjs +1 -1
  13. package/dist/hr-HR.mjs +1 -1
  14. package/dist/hu-HU.mjs +1 -1
  15. package/dist/intlStrings.mjs +1 -1
  16. package/dist/it-IT.mjs +1 -1
  17. package/dist/ja-JP.mjs +1 -1
  18. package/dist/ko-KR.mjs +1 -1
  19. package/dist/lt-LT.mjs +1 -1
  20. package/dist/lv-LV.mjs +1 -1
  21. package/dist/nb-NO.mjs +1 -1
  22. package/dist/nl-NL.mjs +1 -1
  23. package/dist/pl-PL.mjs +1 -1
  24. package/dist/placeholders.main.js +155 -155
  25. package/dist/placeholders.mjs +156 -156
  26. package/dist/placeholders.module.js +155 -155
  27. package/dist/pt-BR.mjs +1 -1
  28. package/dist/pt-PT.mjs +1 -1
  29. package/dist/ro-RO.mjs +1 -1
  30. package/dist/ru-RU.mjs +1 -1
  31. package/dist/sk-SK.mjs +1 -1
  32. package/dist/sl-SI.mjs +1 -1
  33. package/dist/sr-SP.mjs +1 -1
  34. package/dist/sv-SE.mjs +1 -1
  35. package/dist/tr-TR.mjs +1 -1
  36. package/dist/types.d.ts +16 -1
  37. package/dist/types.d.ts.map +1 -1
  38. package/dist/uk-UA.mjs +1 -1
  39. package/dist/useDateFieldState.main.js +50 -42
  40. package/dist/useDateFieldState.main.js.map +1 -1
  41. package/dist/useDateFieldState.mjs +51 -43
  42. package/dist/useDateFieldState.module.js +50 -42
  43. package/dist/useDateFieldState.module.js.map +1 -1
  44. package/dist/useDatePickerState.main.js +17 -9
  45. package/dist/useDatePickerState.main.js.map +1 -1
  46. package/dist/useDatePickerState.mjs +18 -10
  47. package/dist/useDatePickerState.module.js +17 -9
  48. package/dist/useDatePickerState.module.js.map +1 -1
  49. package/dist/useDateRangePickerState.main.js +26 -18
  50. package/dist/useDateRangePickerState.main.js.map +1 -1
  51. package/dist/useDateRangePickerState.mjs +27 -19
  52. package/dist/useDateRangePickerState.module.js +26 -18
  53. package/dist/useDateRangePickerState.module.js.map +1 -1
  54. package/dist/useTimeFieldState.main.js +7 -7
  55. package/dist/useTimeFieldState.mjs +8 -8
  56. package/dist/useTimeFieldState.module.js +7 -7
  57. package/dist/utils.main.js +31 -31
  58. package/dist/utils.main.js.map +1 -1
  59. package/dist/utils.mjs +32 -32
  60. package/dist/utils.module.js +31 -31
  61. package/dist/utils.module.js.map +1 -1
  62. package/dist/zh-CN.mjs +1 -1
  63. package/dist/zh-TW.mjs +1 -1
  64. package/package.json +10 -10
  65. package/src/useDateFieldState.ts +10 -3
  66. package/src/useDatePickerState.ts +9 -2
  67. package/src/useDateRangePickerState.ts +10 -2
  68. package/src/utils.ts +1 -1
@@ -41,15 +41,15 @@ const $3c0fc76039f1c516$var$PAGE_STEP = {
41
41
  };
42
42
  // Node seems to convert everything to lowercase...
43
43
  const $3c0fc76039f1c516$var$TYPE_MAPPING = {
44
- dayperiod: "dayPeriod"
44
+ dayperiod: 'dayPeriod'
45
45
  };
46
46
  function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
47
47
  let { locale: locale, createCalendar: createCalendar, hideTimeZone: hideTimeZone, isDisabled: isDisabled, isReadOnly: isReadOnly, isRequired: isRequired, minValue: minValue, maxValue: maxValue, isDateUnavailable: isDateUnavailable } = props;
48
48
  let v = props.value || props.defaultValue || props.placeholderValue;
49
49
  let [granularity, defaultTimeZone] = (0, $35a22f14a1f04b11$export$2440da353cedad43)(v, props.granularity);
50
- let timeZone = defaultTimeZone || "UTC";
50
+ let timeZone = defaultTimeZone || 'UTC';
51
51
  // props.granularity must actually exist in the value if one is provided.
52
- if (v && !(granularity in v)) throw new Error("Invalid granularity " + granularity + " for value " + v.toString());
52
+ if (v && !(granularity in v)) throw new Error('Invalid granularity ' + granularity + ' for value ' + v.toString());
53
53
  let defaultFormatter = (0, $g03ag$useMemo)(()=>new (0, $g03ag$DateFormatter)(locale), [
54
54
  locale
55
55
  ]);
@@ -68,12 +68,12 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
68
68
  // change from uncontrolled to controlled and emit a warning.
69
69
  let [placeholderDate, setPlaceholderDate] = (0, $g03ag$useState)(()=>(0, $35a22f14a1f04b11$export$66aa2b09de4b1ea5)(props.placeholderValue, granularity, calendar, defaultTimeZone));
70
70
  let val = calendarValue || placeholderDate;
71
- let showEra = calendar.identifier === "gregory" && val.era === "BC";
71
+ let showEra = calendar.identifier === 'gregory' && val.era === 'BC';
72
72
  let formatOpts = (0, $g03ag$useMemo)(()=>{
73
73
  var _props_maxGranularity;
74
74
  return {
75
75
  granularity: granularity,
76
- maxGranularity: (_props_maxGranularity = props.maxGranularity) !== null && _props_maxGranularity !== void 0 ? _props_maxGranularity : "year",
76
+ maxGranularity: (_props_maxGranularity = props.maxGranularity) !== null && _props_maxGranularity !== void 0 ? _props_maxGranularity : 'year',
77
77
  timeZone: defaultTimeZone,
78
78
  hideTimeZone: hideTimeZone,
79
79
  hourCycle: props.hourCycle,
@@ -107,7 +107,7 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
107
107
  let [validSegments, setValidSegments] = (0, $g03ag$useState)(()=>props.value || props.defaultValue ? {
108
108
  ...allSegments
109
109
  } : {});
110
- let clearedSegment = (0, $g03ag$useRef)();
110
+ let clearedSegment = (0, $g03ag$useRef)(undefined);
111
111
  // Reset placeholder when calendar changes
112
112
  let lastCalendarIdentifier = (0, $g03ag$useRef)(calendar.identifier);
113
113
  (0, $g03ag$useEffect)(()=>{
@@ -146,7 +146,7 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
146
146
  setDate(null);
147
147
  setPlaceholderDate((0, $35a22f14a1f04b11$export$66aa2b09de4b1ea5)(props.placeholderValue, granularity, calendar, defaultTimeZone));
148
148
  setValidSegments({});
149
- } else if (validKeys.length >= allKeys.length || validKeys.length === allKeys.length - 1 && allSegments.dayPeriod && !validSegments.dayPeriod && clearedSegment.current !== "dayPeriod") {
149
+ } else if (validKeys.length >= allKeys.length || validKeys.length === allKeys.length - 1 && allSegments.dayPeriod && !validSegments.dayPeriod && clearedSegment.current !== 'dayPeriod') {
150
150
  // The display calendar should not have any effect on the emitted value.
151
151
  // Emit dates in the same calendar as the original value, if any, otherwise gregorian.
152
152
  newValue = (0, $g03ag$toCalendar)(newValue, (v === null || v === void 0 ? void 0 : v.calendar) || new (0, $g03ag$GregorianCalendar)());
@@ -160,7 +160,7 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
160
160
  ]);
161
161
  let segments = (0, $g03ag$useMemo)(()=>dateFormatter.formatToParts(dateValue).map((segment)=>{
162
162
  let isEditable = $3c0fc76039f1c516$var$EDITABLE_SEGMENTS[segment.type];
163
- if (segment.type === "era" && calendar.getEras().length === 1) isEditable = false;
163
+ if (segment.type === 'era' && calendar.getEras().length === 1) isEditable = false;
164
164
  let isPlaceholder = $3c0fc76039f1c516$var$EDITABLE_SEGMENTS[segment.type] && !validSegments[segment.type];
165
165
  let placeholder = $3c0fc76039f1c516$var$EDITABLE_SEGMENTS[segment.type] ? (0, $3e3ed55ab2966714$export$d3f5c5e0a5023fa0)(segment.type, segment.value, locale) : null;
166
166
  return {
@@ -195,7 +195,7 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
195
195
  }
196
196
  let markValid = (part)=>{
197
197
  validSegments[part] = true;
198
- if (part === "year" && allSegments.era) validSegments.era = true;
198
+ if (part === 'year' && allSegments.era) validSegments.era = true;
199
199
  setValidSegments({
200
200
  ...validSegments
201
201
  });
@@ -221,7 +221,7 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
221
221
  builtinValidation: builtinValidation
222
222
  });
223
223
  let isValueInvalid = validation.displayValidation.isInvalid;
224
- let validationState = props.validationState || (isValueInvalid ? "invalid" : null);
224
+ let validationState = props.validationState || (isValueInvalid ? 'invalid' : null);
225
225
  var _props_maxGranularity;
226
226
  return {
227
227
  ...validation,
@@ -234,7 +234,7 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
234
234
  validationState: validationState,
235
235
  isInvalid: isValueInvalid,
236
236
  granularity: granularity,
237
- maxGranularity: (_props_maxGranularity = props.maxGranularity) !== null && _props_maxGranularity !== void 0 ? _props_maxGranularity : "year",
237
+ maxGranularity: (_props_maxGranularity = props.maxGranularity) !== null && _props_maxGranularity !== void 0 ? _props_maxGranularity : 'year',
238
238
  isDisabled: isDisabled,
239
239
  isReadOnly: isReadOnly,
240
240
  isRequired: isRequired,
@@ -276,7 +276,7 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
276
276
  let placeholder = (0, $35a22f14a1f04b11$export$66aa2b09de4b1ea5)(props.placeholderValue, granularity, calendar, defaultTimeZone);
277
277
  let value = displayValue;
278
278
  // Reset day period to default without changing the hour.
279
- if (part === "dayPeriod" && "hour" in displayValue && "hour" in placeholder) {
279
+ if (part === 'dayPeriod' && 'hour' in displayValue && 'hour' in placeholder) {
280
280
  let isPM = displayValue.hour >= 12;
281
281
  let shouldBePM = placeholder.hour >= 12;
282
282
  if (isPM && !shouldBePM) value = displayValue.set({
@@ -292,16 +292,24 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
292
292
  setValue(value);
293
293
  },
294
294
  formatValue (fieldOptions) {
295
- if (!calendarValue) return "";
295
+ if (!calendarValue) return '';
296
296
  let formatOptions = (0, $35a22f14a1f04b11$export$7e319ea407e63bc0)(fieldOptions, formatOpts);
297
297
  let formatter = new (0, $g03ag$DateFormatter)(locale, formatOptions);
298
298
  return formatter.format(dateValue);
299
+ },
300
+ getDateFormatter (locale, formatOptions) {
301
+ let newOptions = {
302
+ ...formatOpts,
303
+ ...formatOptions
304
+ };
305
+ let newFormatOptions = (0, $35a22f14a1f04b11$export$7e319ea407e63bc0)({}, newOptions);
306
+ return new (0, $g03ag$DateFormatter)(locale, newFormatOptions);
299
307
  }
300
308
  };
301
309
  }
302
310
  function $3c0fc76039f1c516$var$getSegmentLimits(date, type, options) {
303
311
  switch(type){
304
- case "era":
312
+ case 'era':
305
313
  {
306
314
  let eras = date.calendar.getEras();
307
315
  return {
@@ -310,33 +318,33 @@ function $3c0fc76039f1c516$var$getSegmentLimits(date, type, options) {
310
318
  maxValue: eras.length - 1
311
319
  };
312
320
  }
313
- case "year":
321
+ case 'year':
314
322
  return {
315
323
  value: date.year,
316
324
  minValue: 1,
317
325
  maxValue: date.calendar.getYearsInEra(date)
318
326
  };
319
- case "month":
327
+ case 'month':
320
328
  return {
321
329
  value: date.month,
322
330
  minValue: (0, $g03ag$getMinimumMonthInYear)(date),
323
331
  maxValue: date.calendar.getMonthsInYear(date)
324
332
  };
325
- case "day":
333
+ case 'day':
326
334
  return {
327
335
  value: date.day,
328
336
  minValue: (0, $g03ag$getMinimumDayInMonth)(date),
329
337
  maxValue: date.calendar.getDaysInMonth(date)
330
338
  };
331
339
  }
332
- if ("hour" in date) switch(type){
333
- case "dayPeriod":
340
+ if ('hour' in date) switch(type){
341
+ case 'dayPeriod':
334
342
  return {
335
343
  value: date.hour >= 12 ? 12 : 0,
336
344
  minValue: 0,
337
345
  maxValue: 12
338
346
  };
339
- case "hour":
347
+ case 'hour':
340
348
  if (options.hour12) {
341
349
  let isPM = date.hour >= 12;
342
350
  return {
@@ -350,13 +358,13 @@ function $3c0fc76039f1c516$var$getSegmentLimits(date, type, options) {
350
358
  minValue: 0,
351
359
  maxValue: 23
352
360
  };
353
- case "minute":
361
+ case 'minute':
354
362
  return {
355
363
  value: date.minute,
356
364
  minValue: 0,
357
365
  maxValue: 59
358
366
  };
359
- case "second":
367
+ case 'second':
360
368
  return {
361
369
  value: date.second,
362
370
  minValue: 0,
@@ -367,16 +375,16 @@ function $3c0fc76039f1c516$var$getSegmentLimits(date, type, options) {
367
375
  }
368
376
  function $3c0fc76039f1c516$var$addSegment(value, part, amount, options) {
369
377
  switch(part){
370
- case "era":
371
- case "year":
372
- case "month":
373
- case "day":
378
+ case 'era':
379
+ case 'year':
380
+ case 'month':
381
+ case 'day':
374
382
  return value.cycle(part, amount, {
375
- round: part === "year"
383
+ round: part === 'year'
376
384
  });
377
385
  }
378
- if ("hour" in value) switch(part){
379
- case "dayPeriod":
386
+ if ('hour' in value) switch(part){
387
+ case 'dayPeriod':
380
388
  {
381
389
  let hours = value.hour;
382
390
  let isPM = hours >= 12;
@@ -384,27 +392,27 @@ function $3c0fc76039f1c516$var$addSegment(value, part, amount, options) {
384
392
  hour: isPM ? hours - 12 : hours + 12
385
393
  });
386
394
  }
387
- case "hour":
388
- case "minute":
389
- case "second":
395
+ case 'hour':
396
+ case 'minute':
397
+ case 'second':
390
398
  return value.cycle(part, amount, {
391
- round: part !== "hour",
399
+ round: part !== 'hour',
392
400
  hourCycle: options.hour12 ? 12 : 24
393
401
  });
394
402
  }
395
403
  }
396
404
  function $3c0fc76039f1c516$var$setSegment(value, part, segmentValue, options) {
397
405
  switch(part){
398
- case "day":
399
- case "month":
400
- case "year":
401
- case "era":
406
+ case 'day':
407
+ case 'month':
408
+ case 'year':
409
+ case 'era':
402
410
  return value.set({
403
411
  [part]: segmentValue
404
412
  });
405
413
  }
406
- if ("hour" in value) switch(part){
407
- case "dayPeriod":
414
+ if ('hour' in value) switch(part){
415
+ case 'dayPeriod':
408
416
  {
409
417
  let hours = value.hour;
410
418
  let wasPM = hours >= 12;
@@ -414,7 +422,7 @@ function $3c0fc76039f1c516$var$setSegment(value, part, segmentValue, options) {
414
422
  hour: wasPM ? hours - 12 : hours + 12
415
423
  });
416
424
  }
417
- case "hour":
425
+ case 'hour':
418
426
  // In 12 hour time, ensure that AM/PM does not change
419
427
  if (options.hour12) {
420
428
  let hours = value.hour;
@@ -423,8 +431,8 @@ function $3c0fc76039f1c516$var$setSegment(value, part, segmentValue, options) {
423
431
  if (wasPM && segmentValue < 12) segmentValue += 12;
424
432
  }
425
433
  // fallthrough
426
- case "minute":
427
- case "second":
434
+ case 'minute':
435
+ case 'second':
428
436
  return value.set({
429
437
  [part]: segmentValue
430
438
  });
@@ -433,4 +441,4 @@ function $3c0fc76039f1c516$var$setSegment(value, part, segmentValue, options) {
433
441
 
434
442
 
435
443
  export {$3c0fc76039f1c516$export$60e84778edff6d26 as useDateFieldState};
436
- //# sourceMappingURL=useDateFieldState.mjs.map
444
+ //# sourceMappingURL=useDateFieldState.module.js.map
@@ -41,15 +41,15 @@ const $3c0fc76039f1c516$var$PAGE_STEP = {
41
41
  };
42
42
  // Node seems to convert everything to lowercase...
43
43
  const $3c0fc76039f1c516$var$TYPE_MAPPING = {
44
- dayperiod: "dayPeriod"
44
+ dayperiod: 'dayPeriod'
45
45
  };
46
46
  function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
47
47
  let { locale: locale, createCalendar: createCalendar, hideTimeZone: hideTimeZone, isDisabled: isDisabled, isReadOnly: isReadOnly, isRequired: isRequired, minValue: minValue, maxValue: maxValue, isDateUnavailable: isDateUnavailable } = props;
48
48
  let v = props.value || props.defaultValue || props.placeholderValue;
49
49
  let [granularity, defaultTimeZone] = (0, $35a22f14a1f04b11$export$2440da353cedad43)(v, props.granularity);
50
- let timeZone = defaultTimeZone || "UTC";
50
+ let timeZone = defaultTimeZone || 'UTC';
51
51
  // props.granularity must actually exist in the value if one is provided.
52
- if (v && !(granularity in v)) throw new Error("Invalid granularity " + granularity + " for value " + v.toString());
52
+ if (v && !(granularity in v)) throw new Error('Invalid granularity ' + granularity + ' for value ' + v.toString());
53
53
  let defaultFormatter = (0, $g03ag$useMemo)(()=>new (0, $g03ag$DateFormatter)(locale), [
54
54
  locale
55
55
  ]);
@@ -68,12 +68,12 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
68
68
  // change from uncontrolled to controlled and emit a warning.
69
69
  let [placeholderDate, setPlaceholderDate] = (0, $g03ag$useState)(()=>(0, $35a22f14a1f04b11$export$66aa2b09de4b1ea5)(props.placeholderValue, granularity, calendar, defaultTimeZone));
70
70
  let val = calendarValue || placeholderDate;
71
- let showEra = calendar.identifier === "gregory" && val.era === "BC";
71
+ let showEra = calendar.identifier === 'gregory' && val.era === 'BC';
72
72
  let formatOpts = (0, $g03ag$useMemo)(()=>{
73
73
  var _props_maxGranularity;
74
74
  return {
75
75
  granularity: granularity,
76
- maxGranularity: (_props_maxGranularity = props.maxGranularity) !== null && _props_maxGranularity !== void 0 ? _props_maxGranularity : "year",
76
+ maxGranularity: (_props_maxGranularity = props.maxGranularity) !== null && _props_maxGranularity !== void 0 ? _props_maxGranularity : 'year',
77
77
  timeZone: defaultTimeZone,
78
78
  hideTimeZone: hideTimeZone,
79
79
  hourCycle: props.hourCycle,
@@ -107,7 +107,7 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
107
107
  let [validSegments, setValidSegments] = (0, $g03ag$useState)(()=>props.value || props.defaultValue ? {
108
108
  ...allSegments
109
109
  } : {});
110
- let clearedSegment = (0, $g03ag$useRef)();
110
+ let clearedSegment = (0, $g03ag$useRef)(undefined);
111
111
  // Reset placeholder when calendar changes
112
112
  let lastCalendarIdentifier = (0, $g03ag$useRef)(calendar.identifier);
113
113
  (0, $g03ag$useEffect)(()=>{
@@ -146,7 +146,7 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
146
146
  setDate(null);
147
147
  setPlaceholderDate((0, $35a22f14a1f04b11$export$66aa2b09de4b1ea5)(props.placeholderValue, granularity, calendar, defaultTimeZone));
148
148
  setValidSegments({});
149
- } else if (validKeys.length >= allKeys.length || validKeys.length === allKeys.length - 1 && allSegments.dayPeriod && !validSegments.dayPeriod && clearedSegment.current !== "dayPeriod") {
149
+ } else if (validKeys.length >= allKeys.length || validKeys.length === allKeys.length - 1 && allSegments.dayPeriod && !validSegments.dayPeriod && clearedSegment.current !== 'dayPeriod') {
150
150
  // The display calendar should not have any effect on the emitted value.
151
151
  // Emit dates in the same calendar as the original value, if any, otherwise gregorian.
152
152
  newValue = (0, $g03ag$toCalendar)(newValue, (v === null || v === void 0 ? void 0 : v.calendar) || new (0, $g03ag$GregorianCalendar)());
@@ -160,7 +160,7 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
160
160
  ]);
161
161
  let segments = (0, $g03ag$useMemo)(()=>dateFormatter.formatToParts(dateValue).map((segment)=>{
162
162
  let isEditable = $3c0fc76039f1c516$var$EDITABLE_SEGMENTS[segment.type];
163
- if (segment.type === "era" && calendar.getEras().length === 1) isEditable = false;
163
+ if (segment.type === 'era' && calendar.getEras().length === 1) isEditable = false;
164
164
  let isPlaceholder = $3c0fc76039f1c516$var$EDITABLE_SEGMENTS[segment.type] && !validSegments[segment.type];
165
165
  let placeholder = $3c0fc76039f1c516$var$EDITABLE_SEGMENTS[segment.type] ? (0, $3e3ed55ab2966714$export$d3f5c5e0a5023fa0)(segment.type, segment.value, locale) : null;
166
166
  return {
@@ -195,7 +195,7 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
195
195
  }
196
196
  let markValid = (part)=>{
197
197
  validSegments[part] = true;
198
- if (part === "year" && allSegments.era) validSegments.era = true;
198
+ if (part === 'year' && allSegments.era) validSegments.era = true;
199
199
  setValidSegments({
200
200
  ...validSegments
201
201
  });
@@ -221,7 +221,7 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
221
221
  builtinValidation: builtinValidation
222
222
  });
223
223
  let isValueInvalid = validation.displayValidation.isInvalid;
224
- let validationState = props.validationState || (isValueInvalid ? "invalid" : null);
224
+ let validationState = props.validationState || (isValueInvalid ? 'invalid' : null);
225
225
  var _props_maxGranularity;
226
226
  return {
227
227
  ...validation,
@@ -234,7 +234,7 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
234
234
  validationState: validationState,
235
235
  isInvalid: isValueInvalid,
236
236
  granularity: granularity,
237
- maxGranularity: (_props_maxGranularity = props.maxGranularity) !== null && _props_maxGranularity !== void 0 ? _props_maxGranularity : "year",
237
+ maxGranularity: (_props_maxGranularity = props.maxGranularity) !== null && _props_maxGranularity !== void 0 ? _props_maxGranularity : 'year',
238
238
  isDisabled: isDisabled,
239
239
  isReadOnly: isReadOnly,
240
240
  isRequired: isRequired,
@@ -276,7 +276,7 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
276
276
  let placeholder = (0, $35a22f14a1f04b11$export$66aa2b09de4b1ea5)(props.placeholderValue, granularity, calendar, defaultTimeZone);
277
277
  let value = displayValue;
278
278
  // Reset day period to default without changing the hour.
279
- if (part === "dayPeriod" && "hour" in displayValue && "hour" in placeholder) {
279
+ if (part === 'dayPeriod' && 'hour' in displayValue && 'hour' in placeholder) {
280
280
  let isPM = displayValue.hour >= 12;
281
281
  let shouldBePM = placeholder.hour >= 12;
282
282
  if (isPM && !shouldBePM) value = displayValue.set({
@@ -292,16 +292,24 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
292
292
  setValue(value);
293
293
  },
294
294
  formatValue (fieldOptions) {
295
- if (!calendarValue) return "";
295
+ if (!calendarValue) return '';
296
296
  let formatOptions = (0, $35a22f14a1f04b11$export$7e319ea407e63bc0)(fieldOptions, formatOpts);
297
297
  let formatter = new (0, $g03ag$DateFormatter)(locale, formatOptions);
298
298
  return formatter.format(dateValue);
299
+ },
300
+ getDateFormatter (locale, formatOptions) {
301
+ let newOptions = {
302
+ ...formatOpts,
303
+ ...formatOptions
304
+ };
305
+ let newFormatOptions = (0, $35a22f14a1f04b11$export$7e319ea407e63bc0)({}, newOptions);
306
+ return new (0, $g03ag$DateFormatter)(locale, newFormatOptions);
299
307
  }
300
308
  };
301
309
  }
302
310
  function $3c0fc76039f1c516$var$getSegmentLimits(date, type, options) {
303
311
  switch(type){
304
- case "era":
312
+ case 'era':
305
313
  {
306
314
  let eras = date.calendar.getEras();
307
315
  return {
@@ -310,33 +318,33 @@ function $3c0fc76039f1c516$var$getSegmentLimits(date, type, options) {
310
318
  maxValue: eras.length - 1
311
319
  };
312
320
  }
313
- case "year":
321
+ case 'year':
314
322
  return {
315
323
  value: date.year,
316
324
  minValue: 1,
317
325
  maxValue: date.calendar.getYearsInEra(date)
318
326
  };
319
- case "month":
327
+ case 'month':
320
328
  return {
321
329
  value: date.month,
322
330
  minValue: (0, $g03ag$getMinimumMonthInYear)(date),
323
331
  maxValue: date.calendar.getMonthsInYear(date)
324
332
  };
325
- case "day":
333
+ case 'day':
326
334
  return {
327
335
  value: date.day,
328
336
  minValue: (0, $g03ag$getMinimumDayInMonth)(date),
329
337
  maxValue: date.calendar.getDaysInMonth(date)
330
338
  };
331
339
  }
332
- if ("hour" in date) switch(type){
333
- case "dayPeriod":
340
+ if ('hour' in date) switch(type){
341
+ case 'dayPeriod':
334
342
  return {
335
343
  value: date.hour >= 12 ? 12 : 0,
336
344
  minValue: 0,
337
345
  maxValue: 12
338
346
  };
339
- case "hour":
347
+ case 'hour':
340
348
  if (options.hour12) {
341
349
  let isPM = date.hour >= 12;
342
350
  return {
@@ -350,13 +358,13 @@ function $3c0fc76039f1c516$var$getSegmentLimits(date, type, options) {
350
358
  minValue: 0,
351
359
  maxValue: 23
352
360
  };
353
- case "minute":
361
+ case 'minute':
354
362
  return {
355
363
  value: date.minute,
356
364
  minValue: 0,
357
365
  maxValue: 59
358
366
  };
359
- case "second":
367
+ case 'second':
360
368
  return {
361
369
  value: date.second,
362
370
  minValue: 0,
@@ -367,16 +375,16 @@ function $3c0fc76039f1c516$var$getSegmentLimits(date, type, options) {
367
375
  }
368
376
  function $3c0fc76039f1c516$var$addSegment(value, part, amount, options) {
369
377
  switch(part){
370
- case "era":
371
- case "year":
372
- case "month":
373
- case "day":
378
+ case 'era':
379
+ case 'year':
380
+ case 'month':
381
+ case 'day':
374
382
  return value.cycle(part, amount, {
375
- round: part === "year"
383
+ round: part === 'year'
376
384
  });
377
385
  }
378
- if ("hour" in value) switch(part){
379
- case "dayPeriod":
386
+ if ('hour' in value) switch(part){
387
+ case 'dayPeriod':
380
388
  {
381
389
  let hours = value.hour;
382
390
  let isPM = hours >= 12;
@@ -384,27 +392,27 @@ function $3c0fc76039f1c516$var$addSegment(value, part, amount, options) {
384
392
  hour: isPM ? hours - 12 : hours + 12
385
393
  });
386
394
  }
387
- case "hour":
388
- case "minute":
389
- case "second":
395
+ case 'hour':
396
+ case 'minute':
397
+ case 'second':
390
398
  return value.cycle(part, amount, {
391
- round: part !== "hour",
399
+ round: part !== 'hour',
392
400
  hourCycle: options.hour12 ? 12 : 24
393
401
  });
394
402
  }
395
403
  }
396
404
  function $3c0fc76039f1c516$var$setSegment(value, part, segmentValue, options) {
397
405
  switch(part){
398
- case "day":
399
- case "month":
400
- case "year":
401
- case "era":
406
+ case 'day':
407
+ case 'month':
408
+ case 'year':
409
+ case 'era':
402
410
  return value.set({
403
411
  [part]: segmentValue
404
412
  });
405
413
  }
406
- if ("hour" in value) switch(part){
407
- case "dayPeriod":
414
+ if ('hour' in value) switch(part){
415
+ case 'dayPeriod':
408
416
  {
409
417
  let hours = value.hour;
410
418
  let wasPM = hours >= 12;
@@ -414,7 +422,7 @@ function $3c0fc76039f1c516$var$setSegment(value, part, segmentValue, options) {
414
422
  hour: wasPM ? hours - 12 : hours + 12
415
423
  });
416
424
  }
417
- case "hour":
425
+ case 'hour':
418
426
  // In 12 hour time, ensure that AM/PM does not change
419
427
  if (options.hour12) {
420
428
  let hours = value.hour;
@@ -423,8 +431,8 @@ function $3c0fc76039f1c516$var$setSegment(value, part, segmentValue, options) {
423
431
  if (wasPM && segmentValue < 12) segmentValue += 12;
424
432
  }
425
433
  // fallthrough
426
- case "minute":
427
- case "second":
434
+ case 'minute':
435
+ case 'second':
428
436
  return value.set({
429
437
  [part]: segmentValue
430
438
  });