@react-stately/datepicker 3.4.1 → 3.6.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.
package/dist/import.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import {toCalendarDate as $7UzoM$toCalendarDate, toCalendarDateTime as $7UzoM$toCalendarDateTime, DateFormatter as $7UzoM$DateFormatter, Time as $7UzoM$Time, toCalendar as $7UzoM$toCalendar, now as $7UzoM$now, GregorianCalendar as $7UzoM$GregorianCalendar, getMinimumMonthInYear as $7UzoM$getMinimumMonthInYear, getMinimumDayInMonth as $7UzoM$getMinimumDayInMonth, toTime as $7UzoM$toTime, today as $7UzoM$today, getLocalTimeZone as $7UzoM$getLocalTimeZone} from "@internationalized/date";
1
+ import {toCalendarDate as $7UzoM$toCalendarDate, toCalendarDateTime as $7UzoM$toCalendarDateTime, DateFormatter as $7UzoM$DateFormatter, Time as $7UzoM$Time, toCalendar as $7UzoM$toCalendar, now as $7UzoM$now, GregorianCalendar as $7UzoM$GregorianCalendar, getMinimumMonthInYear as $7UzoM$getMinimumMonthInYear, getMinimumDayInMonth as $7UzoM$getMinimumDayInMonth, toZoned as $7UzoM$toZoned, toTime as $7UzoM$toTime, today as $7UzoM$today, getLocalTimeZone as $7UzoM$getLocalTimeZone} from "@internationalized/date";
2
2
  import {useOverlayTriggerState as $7UzoM$useOverlayTriggerState} from "@react-stately/overlays";
3
3
  import {useControlledState as $7UzoM$useControlledState} from "@react-stately/utils";
4
- import {useState as $7UzoM$useState, useRef as $7UzoM$useRef, useMemo as $7UzoM$useMemo, useEffect as $7UzoM$useEffect} from "react";
4
+ import {useState as $7UzoM$useState, useMemo as $7UzoM$useMemo, useRef as $7UzoM$useRef, useEffect as $7UzoM$useEffect} from "react";
5
5
  import {LocalizedStringDictionary as $7UzoM$LocalizedStringDictionary} from "@internationalized/string";
6
6
 
7
7
  /*
@@ -48,9 +48,18 @@ const $35a22f14a1f04b11$var$DEFAULT_FIELD_OPTIONS = {
48
48
  minute: "2-digit",
49
49
  second: "2-digit"
50
50
  };
51
+ const $35a22f14a1f04b11$var$TWO_DIGIT_FIELD_OPTIONS = {
52
+ year: "numeric",
53
+ month: "2-digit",
54
+ day: "2-digit",
55
+ hour: "2-digit",
56
+ minute: "2-digit",
57
+ second: "2-digit"
58
+ };
51
59
  function $35a22f14a1f04b11$export$7e319ea407e63bc0(fieldOptions, options) {
60
+ let defaultFieldOptions = options.shouldForceLeadingZeros ? $35a22f14a1f04b11$var$TWO_DIGIT_FIELD_OPTIONS : $35a22f14a1f04b11$var$DEFAULT_FIELD_OPTIONS;
52
61
  fieldOptions = {
53
- ...$35a22f14a1f04b11$var$DEFAULT_FIELD_OPTIONS,
62
+ ...defaultFieldOptions,
54
63
  ...fieldOptions
55
64
  };
56
65
  let granularity = options.granularity || "minute";
@@ -95,16 +104,24 @@ function $35a22f14a1f04b11$export$66aa2b09de4b1ea5(placeholderValue, granularity
95
104
  }
96
105
  function $35a22f14a1f04b11$export$2440da353cedad43(v, granularity) {
97
106
  // Compute default granularity and time zone from the value. If the value becomes null, keep the last values.
98
- let lastValue = (0, $7UzoM$useRef)(v);
99
- if (v) lastValue.current = v;
100
- v = lastValue.current;
101
107
  let defaultTimeZone = v && "timeZone" in v ? v.timeZone : undefined;
102
- granularity = granularity || (v && "minute" in v ? "minute" : "day");
108
+ let defaultGranularity = v && "minute" in v ? "minute" : "day";
103
109
  // props.granularity must actually exist in the value if one is provided.
104
- if (v && !(granularity in v)) throw new Error("Invalid granularity " + granularity + " for value " + v.toString());
110
+ if (v && granularity && !(granularity in v)) throw new Error("Invalid granularity " + granularity + " for value " + v.toString());
111
+ let [lastValue, setLastValue] = (0, $7UzoM$useState)([
112
+ defaultGranularity,
113
+ defaultTimeZone
114
+ ]);
115
+ // If the granularity or time zone changed, update the last value.
116
+ if (v && (lastValue[0] !== defaultGranularity || lastValue[1] !== defaultTimeZone)) setLastValue([
117
+ defaultGranularity,
118
+ defaultTimeZone
119
+ ]);
120
+ if (!granularity) granularity = v ? defaultGranularity : lastValue[0];
121
+ let timeZone = v ? defaultTimeZone : lastValue[1];
105
122
  return [
106
123
  granularity,
107
- defaultTimeZone
124
+ timeZone
108
125
  ];
109
126
  }
110
127
 
@@ -112,7 +129,6 @@ function $35a22f14a1f04b11$export$2440da353cedad43(v, granularity) {
112
129
 
113
130
 
114
131
 
115
-
116
132
  function $ab5bf3f618090389$export$87194bb378cc3ac2(props) {
117
133
  var _props_isDateUnavailable;
118
134
  let overlayState = (0, $7UzoM$useOverlayTriggerState)(props);
@@ -146,7 +162,7 @@ function $ab5bf3f618090389$export$87194bb378cc3ac2(props) {
146
162
  if (shouldClose) overlayState.setOpen(false);
147
163
  };
148
164
  let selectTime = (newValue)=>{
149
- if (selectedDate) commitValue(selectedDate, newValue);
165
+ if (selectedDate && newValue) commitValue(selectedDate, newValue);
150
166
  else setSelectedTime(newValue);
151
167
  };
152
168
  let validationState = props.validationState || ((0, $35a22f14a1f04b11$export$eac50920cf2fd59a)(value, props.minValue, props.maxValue) ? "invalid" : null) || (value && ((_props_isDateUnavailable = props.isDateUnavailable) === null || _props_isDateUnavailable === void 0 ? void 0 : _props_isDateUnavailable.call(props, value)) ? "invalid" : null);
@@ -653,11 +669,13 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
653
669
  timeZone: defaultTimeZone,
654
670
  hideTimeZone: hideTimeZone,
655
671
  hourCycle: props.hourCycle,
656
- showEra: showEra
672
+ showEra: showEra,
673
+ shouldForceLeadingZeros: props.shouldForceLeadingZeros
657
674
  }), [
658
675
  props.maxGranularity,
659
676
  granularity,
660
677
  props.hourCycle,
678
+ props.shouldForceLeadingZeros,
661
679
  defaultTimeZone,
662
680
  hideTimeZone,
663
681
  showEra
@@ -680,6 +698,7 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
680
698
  let [validSegments, setValidSegments] = (0, $7UzoM$useState)(()=>props.value || props.defaultValue ? {
681
699
  ...allSegments
682
700
  } : {});
701
+ let clearedSegment = (0, $7UzoM$useRef)();
683
702
  // Reset placeholder when calendar changes
684
703
  let lastCalendarIdentifier = (0, $7UzoM$useRef)(calendar.identifier);
685
704
  (0, $7UzoM$useEffect)(()=>{
@@ -711,12 +730,20 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
711
730
  let displayValue = calendarValue && Object.keys(validSegments).length >= Object.keys(allSegments).length ? calendarValue : placeholderDate;
712
731
  let setValue = (newValue)=>{
713
732
  if (props.isDisabled || props.isReadOnly) return;
714
- if (Object.keys(validSegments).length >= Object.keys(allSegments).length) {
733
+ let validKeys = Object.keys(validSegments);
734
+ let allKeys = Object.keys(allSegments);
735
+ // if all the segments are completed or a timefield with everything but am/pm set the time, also ignore when am/pm cleared
736
+ if (newValue == null) {
737
+ setDate(null);
738
+ setPlaceholderDate((0, $35a22f14a1f04b11$export$66aa2b09de4b1ea5)(props.placeholderValue, granularity, calendar, defaultTimeZone));
739
+ setValidSegments({});
740
+ } else if (validKeys.length >= allKeys.length || validKeys.length === allKeys.length - 1 && allSegments.dayPeriod && !validSegments.dayPeriod && clearedSegment.current !== "dayPeriod") {
715
741
  // The display calendar should not have any effect on the emitted value.
716
742
  // Emit dates in the same calendar as the original value, if any, otherwise gregorian.
717
743
  newValue = (0, $7UzoM$toCalendar)(newValue, (v === null || v === void 0 ? void 0 : v.calendar) || new (0, $7UzoM$GregorianCalendar)());
718
744
  setDate(newValue);
719
745
  } else setPlaceholderDate(newValue);
746
+ clearedSegment.current = null;
720
747
  };
721
748
  let dateValue = (0, $7UzoM$useMemo)(()=>displayValue.toDate(timeZone), [
722
749
  displayValue,
@@ -767,7 +794,9 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
767
794
  let adjustSegment = (type, amount)=>{
768
795
  if (!validSegments[type]) {
769
796
  markValid(type);
770
- if (Object.keys(validSegments).length >= Object.keys(allSegments).length) setValue(displayValue);
797
+ let validKeys = Object.keys(validSegments);
798
+ let allKeys = Object.keys(allSegments);
799
+ if (validKeys.length >= allKeys.length || validKeys.length === allKeys.length - 1 && allSegments.dayPeriod && !validSegments.dayPeriod) setValue(displayValue);
771
800
  } else setValue($3c0fc76039f1c516$var$addSegment(displayValue, type, amount, resolvedOptions));
772
801
  };
773
802
  let validationState = props.validationState || ((0, $35a22f14a1f04b11$export$eac50920cf2fd59a)(calendarValue, props.minValue, props.maxValue) ? "invalid" : null);
@@ -816,6 +845,7 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
816
845
  },
817
846
  clearSegment (part) {
818
847
  delete validSegments[part];
848
+ clearedSegment.current = part;
819
849
  setValidSegments({
820
850
  ...validSegments
821
851
  });
@@ -963,10 +993,10 @@ function $3c0fc76039f1c516$var$setSegment(value, part, segmentValue, options) {
963
993
  case "hour":
964
994
  // In 12 hour time, ensure that AM/PM does not change
965
995
  if (options.hour12) {
966
- let hours1 = value.hour;
967
- let wasPM1 = hours1 >= 12;
968
- if (!wasPM1 && segmentValue === 12) segmentValue = 0;
969
- if (wasPM1 && segmentValue < 12) segmentValue += 12;
996
+ let hours = value.hour;
997
+ let wasPM = hours >= 12;
998
+ if (!wasPM && segmentValue === 12) segmentValue = 0;
999
+ if (wasPM && segmentValue < 12) segmentValue += 12;
970
1000
  }
971
1001
  // fallthrough
972
1002
  case "minute":
@@ -1125,9 +1155,9 @@ function $93c38a5e28be6249$export$e50a61c1de9f574(props) {
1125
1155
  // Now we can combine the parts into start and end strings.
1126
1156
  let start = "";
1127
1157
  let end = "";
1128
- for(let i1 = 0; i1 < parts.length; i1++){
1129
- if (i1 < separatorIndex) start += parts[i1].value;
1130
- else if (i1 > separatorIndex) end += parts[i1].value;
1158
+ for(let i = 0; i < parts.length; i++){
1159
+ if (i < separatorIndex) start += parts[i].value;
1160
+ else if (i > separatorIndex) end += parts[i].value;
1131
1161
  }
1132
1162
  return {
1133
1163
  start: start,
@@ -1174,8 +1204,14 @@ function $eff5d8ee529ac4bb$export$fd53cef0cc796101(props) {
1174
1204
  let [value, setValue] = (0, $7UzoM$useControlledState)(props.value, props.defaultValue, props.onChange);
1175
1205
  let v = value || placeholderValue;
1176
1206
  let day = v && "day" in v ? v : undefined;
1177
- let placeholderDate = (0, $7UzoM$useMemo)(()=>$eff5d8ee529ac4bb$var$convertValue(placeholderValue), [
1178
- placeholderValue
1207
+ let defaultValueTimeZone = props.defaultValue && "timeZone" in props.defaultValue ? props.defaultValue.timeZone : undefined;
1208
+ let placeholderDate = (0, $7UzoM$useMemo)(()=>{
1209
+ let valueTimeZone = v && "timeZone" in v ? v.timeZone : undefined;
1210
+ return (valueTimeZone || defaultValueTimeZone) && placeholderValue ? (0, $7UzoM$toZoned)($eff5d8ee529ac4bb$var$convertValue(placeholderValue), valueTimeZone || defaultValueTimeZone) : $eff5d8ee529ac4bb$var$convertValue(placeholderValue);
1211
+ }, [
1212
+ placeholderValue,
1213
+ v,
1214
+ defaultValueTimeZone
1179
1215
  ]);
1180
1216
  let minDate = (0, $7UzoM$useMemo)(()=>$eff5d8ee529ac4bb$var$convertValue(minValue, day), [
1181
1217
  minValue,
@@ -1185,13 +1221,16 @@ function $eff5d8ee529ac4bb$export$fd53cef0cc796101(props) {
1185
1221
  maxValue,
1186
1222
  day
1187
1223
  ]);
1224
+ let timeValue = (0, $7UzoM$useMemo)(()=>value && "day" in value ? (0, $7UzoM$toTime)(value) : value, [
1225
+ value
1226
+ ]);
1188
1227
  let dateTime = (0, $7UzoM$useMemo)(()=>value == null ? null : $eff5d8ee529ac4bb$var$convertValue(value), [
1189
1228
  value
1190
1229
  ]);
1191
1230
  let onChange = (newValue)=>{
1192
- setValue(v && "day" in v ? newValue : newValue && (0, $7UzoM$toTime)(newValue));
1231
+ setValue(day || defaultValueTimeZone ? newValue : newValue && (0, $7UzoM$toTime)(newValue));
1193
1232
  };
1194
- return (0, $3c0fc76039f1c516$export$60e84778edff6d26)({
1233
+ let state = (0, $3c0fc76039f1c516$export$60e84778edff6d26)({
1195
1234
  ...props,
1196
1235
  value: dateTime,
1197
1236
  defaultValue: undefined,
@@ -1204,6 +1243,10 @@ function $eff5d8ee529ac4bb$export$fd53cef0cc796101(props) {
1204
1243
  // Calendar should not matter for time fields.
1205
1244
  createCalendar: ()=>new (0, $7UzoM$GregorianCalendar)()
1206
1245
  });
1246
+ return {
1247
+ ...state,
1248
+ timeValue: timeValue
1249
+ };
1207
1250
  }
1208
1251
  function $eff5d8ee529ac4bb$var$convertValue(value, date = (0, $7UzoM$today)((0, $7UzoM$getLocalTimeZone)())) {
1209
1252
  if (!value) return null;
package/dist/main.js CHANGED
@@ -56,9 +56,18 @@ const $50d5d6a623389320$var$DEFAULT_FIELD_OPTIONS = {
56
56
  minute: "2-digit",
57
57
  second: "2-digit"
58
58
  };
59
+ const $50d5d6a623389320$var$TWO_DIGIT_FIELD_OPTIONS = {
60
+ year: "numeric",
61
+ month: "2-digit",
62
+ day: "2-digit",
63
+ hour: "2-digit",
64
+ minute: "2-digit",
65
+ second: "2-digit"
66
+ };
59
67
  function $50d5d6a623389320$export$7e319ea407e63bc0(fieldOptions, options) {
68
+ let defaultFieldOptions = options.shouldForceLeadingZeros ? $50d5d6a623389320$var$TWO_DIGIT_FIELD_OPTIONS : $50d5d6a623389320$var$DEFAULT_FIELD_OPTIONS;
60
69
  fieldOptions = {
61
- ...$50d5d6a623389320$var$DEFAULT_FIELD_OPTIONS,
70
+ ...defaultFieldOptions,
62
71
  ...fieldOptions
63
72
  };
64
73
  let granularity = options.granularity || "minute";
@@ -103,16 +112,24 @@ function $50d5d6a623389320$export$66aa2b09de4b1ea5(placeholderValue, granularity
103
112
  }
104
113
  function $50d5d6a623389320$export$2440da353cedad43(v, granularity) {
105
114
  // Compute default granularity and time zone from the value. If the value becomes null, keep the last values.
106
- let lastValue = (0, $h2qOe$react.useRef)(v);
107
- if (v) lastValue.current = v;
108
- v = lastValue.current;
109
115
  let defaultTimeZone = v && "timeZone" in v ? v.timeZone : undefined;
110
- granularity = granularity || (v && "minute" in v ? "minute" : "day");
116
+ let defaultGranularity = v && "minute" in v ? "minute" : "day";
111
117
  // props.granularity must actually exist in the value if one is provided.
112
- if (v && !(granularity in v)) throw new Error("Invalid granularity " + granularity + " for value " + v.toString());
118
+ if (v && granularity && !(granularity in v)) throw new Error("Invalid granularity " + granularity + " for value " + v.toString());
119
+ let [lastValue, setLastValue] = (0, $h2qOe$react.useState)([
120
+ defaultGranularity,
121
+ defaultTimeZone
122
+ ]);
123
+ // If the granularity or time zone changed, update the last value.
124
+ if (v && (lastValue[0] !== defaultGranularity || lastValue[1] !== defaultTimeZone)) setLastValue([
125
+ defaultGranularity,
126
+ defaultTimeZone
127
+ ]);
128
+ if (!granularity) granularity = v ? defaultGranularity : lastValue[0];
129
+ let timeZone = v ? defaultTimeZone : lastValue[1];
113
130
  return [
114
131
  granularity,
115
- defaultTimeZone
132
+ timeZone
116
133
  ];
117
134
  }
118
135
 
@@ -120,7 +137,6 @@ function $50d5d6a623389320$export$2440da353cedad43(v, granularity) {
120
137
 
121
138
 
122
139
 
123
-
124
140
  function $aaab7a647e17e1fd$export$87194bb378cc3ac2(props) {
125
141
  var _props_isDateUnavailable;
126
142
  let overlayState = (0, $h2qOe$reactstatelyoverlays.useOverlayTriggerState)(props);
@@ -154,7 +170,7 @@ function $aaab7a647e17e1fd$export$87194bb378cc3ac2(props) {
154
170
  if (shouldClose) overlayState.setOpen(false);
155
171
  };
156
172
  let selectTime = (newValue)=>{
157
- if (selectedDate) commitValue(selectedDate, newValue);
173
+ if (selectedDate && newValue) commitValue(selectedDate, newValue);
158
174
  else setSelectedTime(newValue);
159
175
  };
160
176
  let validationState = props.validationState || ((0, $50d5d6a623389320$export$eac50920cf2fd59a)(value, props.minValue, props.maxValue) ? "invalid" : null) || (value && ((_props_isDateUnavailable = props.isDateUnavailable) === null || _props_isDateUnavailable === void 0 ? void 0 : _props_isDateUnavailable.call(props, value)) ? "invalid" : null);
@@ -661,11 +677,13 @@ function $596a1f0f523d6752$export$60e84778edff6d26(props) {
661
677
  timeZone: defaultTimeZone,
662
678
  hideTimeZone: hideTimeZone,
663
679
  hourCycle: props.hourCycle,
664
- showEra: showEra
680
+ showEra: showEra,
681
+ shouldForceLeadingZeros: props.shouldForceLeadingZeros
665
682
  }), [
666
683
  props.maxGranularity,
667
684
  granularity,
668
685
  props.hourCycle,
686
+ props.shouldForceLeadingZeros,
669
687
  defaultTimeZone,
670
688
  hideTimeZone,
671
689
  showEra
@@ -688,6 +706,7 @@ function $596a1f0f523d6752$export$60e84778edff6d26(props) {
688
706
  let [validSegments, setValidSegments] = (0, $h2qOe$react.useState)(()=>props.value || props.defaultValue ? {
689
707
  ...allSegments
690
708
  } : {});
709
+ let clearedSegment = (0, $h2qOe$react.useRef)();
691
710
  // Reset placeholder when calendar changes
692
711
  let lastCalendarIdentifier = (0, $h2qOe$react.useRef)(calendar.identifier);
693
712
  (0, $h2qOe$react.useEffect)(()=>{
@@ -719,12 +738,20 @@ function $596a1f0f523d6752$export$60e84778edff6d26(props) {
719
738
  let displayValue = calendarValue && Object.keys(validSegments).length >= Object.keys(allSegments).length ? calendarValue : placeholderDate;
720
739
  let setValue = (newValue)=>{
721
740
  if (props.isDisabled || props.isReadOnly) return;
722
- if (Object.keys(validSegments).length >= Object.keys(allSegments).length) {
741
+ let validKeys = Object.keys(validSegments);
742
+ let allKeys = Object.keys(allSegments);
743
+ // if all the segments are completed or a timefield with everything but am/pm set the time, also ignore when am/pm cleared
744
+ if (newValue == null) {
745
+ setDate(null);
746
+ setPlaceholderDate((0, $50d5d6a623389320$export$66aa2b09de4b1ea5)(props.placeholderValue, granularity, calendar, defaultTimeZone));
747
+ setValidSegments({});
748
+ } else if (validKeys.length >= allKeys.length || validKeys.length === allKeys.length - 1 && allSegments.dayPeriod && !validSegments.dayPeriod && clearedSegment.current !== "dayPeriod") {
723
749
  // The display calendar should not have any effect on the emitted value.
724
750
  // Emit dates in the same calendar as the original value, if any, otherwise gregorian.
725
751
  newValue = (0, $h2qOe$internationalizeddate.toCalendar)(newValue, (v === null || v === void 0 ? void 0 : v.calendar) || new (0, $h2qOe$internationalizeddate.GregorianCalendar)());
726
752
  setDate(newValue);
727
753
  } else setPlaceholderDate(newValue);
754
+ clearedSegment.current = null;
728
755
  };
729
756
  let dateValue = (0, $h2qOe$react.useMemo)(()=>displayValue.toDate(timeZone), [
730
757
  displayValue,
@@ -775,7 +802,9 @@ function $596a1f0f523d6752$export$60e84778edff6d26(props) {
775
802
  let adjustSegment = (type, amount)=>{
776
803
  if (!validSegments[type]) {
777
804
  markValid(type);
778
- if (Object.keys(validSegments).length >= Object.keys(allSegments).length) setValue(displayValue);
805
+ let validKeys = Object.keys(validSegments);
806
+ let allKeys = Object.keys(allSegments);
807
+ if (validKeys.length >= allKeys.length || validKeys.length === allKeys.length - 1 && allSegments.dayPeriod && !validSegments.dayPeriod) setValue(displayValue);
779
808
  } else setValue($596a1f0f523d6752$var$addSegment(displayValue, type, amount, resolvedOptions));
780
809
  };
781
810
  let validationState = props.validationState || ((0, $50d5d6a623389320$export$eac50920cf2fd59a)(calendarValue, props.minValue, props.maxValue) ? "invalid" : null);
@@ -824,6 +853,7 @@ function $596a1f0f523d6752$export$60e84778edff6d26(props) {
824
853
  },
825
854
  clearSegment (part) {
826
855
  delete validSegments[part];
856
+ clearedSegment.current = part;
827
857
  setValidSegments({
828
858
  ...validSegments
829
859
  });
@@ -971,10 +1001,10 @@ function $596a1f0f523d6752$var$setSegment(value, part, segmentValue, options) {
971
1001
  case "hour":
972
1002
  // In 12 hour time, ensure that AM/PM does not change
973
1003
  if (options.hour12) {
974
- let hours1 = value.hour;
975
- let wasPM1 = hours1 >= 12;
976
- if (!wasPM1 && segmentValue === 12) segmentValue = 0;
977
- if (wasPM1 && segmentValue < 12) segmentValue += 12;
1004
+ let hours = value.hour;
1005
+ let wasPM = hours >= 12;
1006
+ if (!wasPM && segmentValue === 12) segmentValue = 0;
1007
+ if (wasPM && segmentValue < 12) segmentValue += 12;
978
1008
  }
979
1009
  // fallthrough
980
1010
  case "minute":
@@ -1133,9 +1163,9 @@ function $7072d26f58deb33b$export$e50a61c1de9f574(props) {
1133
1163
  // Now we can combine the parts into start and end strings.
1134
1164
  let start = "";
1135
1165
  let end = "";
1136
- for(let i1 = 0; i1 < parts.length; i1++){
1137
- if (i1 < separatorIndex) start += parts[i1].value;
1138
- else if (i1 > separatorIndex) end += parts[i1].value;
1166
+ for(let i = 0; i < parts.length; i++){
1167
+ if (i < separatorIndex) start += parts[i].value;
1168
+ else if (i > separatorIndex) end += parts[i].value;
1139
1169
  }
1140
1170
  return {
1141
1171
  start: start,
@@ -1182,8 +1212,14 @@ function $2654e87be0231a69$export$fd53cef0cc796101(props) {
1182
1212
  let [value, setValue] = (0, $h2qOe$reactstatelyutils.useControlledState)(props.value, props.defaultValue, props.onChange);
1183
1213
  let v = value || placeholderValue;
1184
1214
  let day = v && "day" in v ? v : undefined;
1185
- let placeholderDate = (0, $h2qOe$react.useMemo)(()=>$2654e87be0231a69$var$convertValue(placeholderValue), [
1186
- placeholderValue
1215
+ let defaultValueTimeZone = props.defaultValue && "timeZone" in props.defaultValue ? props.defaultValue.timeZone : undefined;
1216
+ let placeholderDate = (0, $h2qOe$react.useMemo)(()=>{
1217
+ let valueTimeZone = v && "timeZone" in v ? v.timeZone : undefined;
1218
+ return (valueTimeZone || defaultValueTimeZone) && placeholderValue ? (0, $h2qOe$internationalizeddate.toZoned)($2654e87be0231a69$var$convertValue(placeholderValue), valueTimeZone || defaultValueTimeZone) : $2654e87be0231a69$var$convertValue(placeholderValue);
1219
+ }, [
1220
+ placeholderValue,
1221
+ v,
1222
+ defaultValueTimeZone
1187
1223
  ]);
1188
1224
  let minDate = (0, $h2qOe$react.useMemo)(()=>$2654e87be0231a69$var$convertValue(minValue, day), [
1189
1225
  minValue,
@@ -1193,13 +1229,16 @@ function $2654e87be0231a69$export$fd53cef0cc796101(props) {
1193
1229
  maxValue,
1194
1230
  day
1195
1231
  ]);
1232
+ let timeValue = (0, $h2qOe$react.useMemo)(()=>value && "day" in value ? (0, $h2qOe$internationalizeddate.toTime)(value) : value, [
1233
+ value
1234
+ ]);
1196
1235
  let dateTime = (0, $h2qOe$react.useMemo)(()=>value == null ? null : $2654e87be0231a69$var$convertValue(value), [
1197
1236
  value
1198
1237
  ]);
1199
1238
  let onChange = (newValue)=>{
1200
- setValue(v && "day" in v ? newValue : newValue && (0, $h2qOe$internationalizeddate.toTime)(newValue));
1239
+ setValue(day || defaultValueTimeZone ? newValue : newValue && (0, $h2qOe$internationalizeddate.toTime)(newValue));
1201
1240
  };
1202
- return (0, $596a1f0f523d6752$export$60e84778edff6d26)({
1241
+ let state = (0, $596a1f0f523d6752$export$60e84778edff6d26)({
1203
1242
  ...props,
1204
1243
  value: dateTime,
1205
1244
  defaultValue: undefined,
@@ -1212,6 +1251,10 @@ function $2654e87be0231a69$export$fd53cef0cc796101(props) {
1212
1251
  // Calendar should not matter for time fields.
1213
1252
  createCalendar: ()=>new (0, $h2qOe$internationalizeddate.GregorianCalendar)()
1214
1253
  });
1254
+ return {
1255
+ ...state,
1256
+ timeValue: timeValue
1257
+ };
1215
1258
  }
1216
1259
  function $2654e87be0231a69$var$convertValue(value, date = (0, $h2qOe$internationalizeddate.today)((0, $h2qOe$internationalizeddate.getLocalTimeZone)())) {
1217
1260
  if (!value) return null;