@react-stately/datepicker 3.5.0 → 3.7.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,4 +1,4 @@
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
4
  import {useState as $7UzoM$useState, useMemo as $7UzoM$useMemo, useRef as $7UzoM$useRef, useEffect as $7UzoM$useEffect} from "react";
@@ -165,7 +165,8 @@ function $ab5bf3f618090389$export$87194bb378cc3ac2(props) {
165
165
  if (selectedDate && newValue) commitValue(selectedDate, newValue);
166
166
  else setSelectedTime(newValue);
167
167
  };
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);
168
+ let isValueInvalid = props.isInvalid || props.validationState === "invalid" || (0, $35a22f14a1f04b11$export$eac50920cf2fd59a)(value, props.minValue, props.maxValue) || value && ((_props_isDateUnavailable = props.isDateUnavailable) === null || _props_isDateUnavailable === void 0 ? void 0 : _props_isDateUnavailable.call(props, value));
169
+ let validationState = props.validationState || (isValueInvalid ? "invalid" : null);
169
170
  return {
170
171
  value: value,
171
172
  setValue: setValue,
@@ -184,6 +185,7 @@ function $ab5bf3f618090389$export$87194bb378cc3ac2(props) {
184
185
  overlayState.setOpen(isOpen);
185
186
  },
186
187
  validationState: validationState,
188
+ isInvalid: isValueInvalid,
187
189
  formatValue (locale, fieldOptions) {
188
190
  if (!dateValue) return "";
189
191
  let formatOptions = (0, $35a22f14a1f04b11$export$7e319ea407e63bc0)(fieldOptions, {
@@ -698,6 +700,7 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
698
700
  let [validSegments, setValidSegments] = (0, $7UzoM$useState)(()=>props.value || props.defaultValue ? {
699
701
  ...allSegments
700
702
  } : {});
703
+ let clearedSegment = (0, $7UzoM$useRef)();
701
704
  // Reset placeholder when calendar changes
702
705
  let lastCalendarIdentifier = (0, $7UzoM$useRef)(calendar.identifier);
703
706
  (0, $7UzoM$useEffect)(()=>{
@@ -729,12 +732,20 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
729
732
  let displayValue = calendarValue && Object.keys(validSegments).length >= Object.keys(allSegments).length ? calendarValue : placeholderDate;
730
733
  let setValue = (newValue)=>{
731
734
  if (props.isDisabled || props.isReadOnly) return;
732
- if (Object.keys(validSegments).length >= Object.keys(allSegments).length) {
735
+ let validKeys = Object.keys(validSegments);
736
+ let allKeys = Object.keys(allSegments);
737
+ // if all the segments are completed or a timefield with everything but am/pm set the time, also ignore when am/pm cleared
738
+ if (newValue == null) {
739
+ setDate(null);
740
+ setPlaceholderDate((0, $35a22f14a1f04b11$export$66aa2b09de4b1ea5)(props.placeholderValue, granularity, calendar, defaultTimeZone));
741
+ setValidSegments({});
742
+ } else if (validKeys.length >= allKeys.length || validKeys.length === allKeys.length - 1 && allSegments.dayPeriod && !validSegments.dayPeriod && clearedSegment.current !== "dayPeriod") {
733
743
  // The display calendar should not have any effect on the emitted value.
734
744
  // Emit dates in the same calendar as the original value, if any, otherwise gregorian.
735
745
  newValue = (0, $7UzoM$toCalendar)(newValue, (v === null || v === void 0 ? void 0 : v.calendar) || new (0, $7UzoM$GregorianCalendar)());
736
746
  setDate(newValue);
737
747
  } else setPlaceholderDate(newValue);
748
+ clearedSegment.current = null;
738
749
  };
739
750
  let dateValue = (0, $7UzoM$useMemo)(()=>displayValue.toDate(timeZone), [
740
751
  displayValue,
@@ -785,10 +796,13 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
785
796
  let adjustSegment = (type, amount)=>{
786
797
  if (!validSegments[type]) {
787
798
  markValid(type);
788
- if (Object.keys(validSegments).length >= Object.keys(allSegments).length) setValue(displayValue);
799
+ let validKeys = Object.keys(validSegments);
800
+ let allKeys = Object.keys(allSegments);
801
+ if (validKeys.length >= allKeys.length || validKeys.length === allKeys.length - 1 && allSegments.dayPeriod && !validSegments.dayPeriod) setValue(displayValue);
789
802
  } else setValue($3c0fc76039f1c516$var$addSegment(displayValue, type, amount, resolvedOptions));
790
803
  };
791
- let validationState = props.validationState || ((0, $35a22f14a1f04b11$export$eac50920cf2fd59a)(calendarValue, props.minValue, props.maxValue) ? "invalid" : null);
804
+ let isValueInvalid = props.isInvalid || props.validationState === "invalid" || (0, $35a22f14a1f04b11$export$eac50920cf2fd59a)(calendarValue, props.minValue, props.maxValue);
805
+ let validationState = props.validationState || (isValueInvalid ? "invalid" : null);
792
806
  var _props_maxGranularity1;
793
807
  return {
794
808
  value: calendarValue,
@@ -798,6 +812,7 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
798
812
  segments: segments,
799
813
  dateFormatter: dateFormatter,
800
814
  validationState: validationState,
815
+ isInvalid: isValueInvalid,
801
816
  granularity: granularity,
802
817
  maxGranularity: (_props_maxGranularity1 = props.maxGranularity) !== null && _props_maxGranularity1 !== void 0 ? _props_maxGranularity1 : "year",
803
818
  isDisabled: isDisabled,
@@ -834,6 +849,7 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
834
849
  },
835
850
  clearSegment (part) {
836
851
  delete validSegments[part];
852
+ clearedSegment.current = part;
837
853
  setValidSegments({
838
854
  ...validSegments
839
855
  });
@@ -1069,7 +1085,8 @@ function $93c38a5e28be6249$export$e50a61c1de9f574(props) {
1069
1085
  if ((dateRange === null || dateRange === void 0 ? void 0 : dateRange.start) && (dateRange === null || dateRange === void 0 ? void 0 : dateRange.end) && range.start && range.end) commitValue(dateRange, range);
1070
1086
  else setSelectedTimeRange(range);
1071
1087
  };
1072
- let validationState = props.validationState || (value != null && ((0, $35a22f14a1f04b11$export$eac50920cf2fd59a)(value.start, props.minValue, props.maxValue) || (0, $35a22f14a1f04b11$export$eac50920cf2fd59a)(value.end, props.minValue, props.maxValue) || value.end != null && value.start != null && value.end.compare(value.start) < 0 || (value === null || value === void 0 ? void 0 : value.start) && ((_props_isDateUnavailable = props.isDateUnavailable) === null || _props_isDateUnavailable === void 0 ? void 0 : _props_isDateUnavailable.call(props, value.start)) || (value === null || value === void 0 ? void 0 : value.end) && ((_props_isDateUnavailable1 = props.isDateUnavailable) === null || _props_isDateUnavailable1 === void 0 ? void 0 : _props_isDateUnavailable1.call(props, value.end))) ? "invalid" : null);
1088
+ let isValueInvalid = props.isInvalid || props.validationState === "invalid" || value != null && ((0, $35a22f14a1f04b11$export$eac50920cf2fd59a)(value.start, props.minValue, props.maxValue) || (0, $35a22f14a1f04b11$export$eac50920cf2fd59a)(value.end, props.minValue, props.maxValue) || value.end != null && value.start != null && value.end.compare(value.start) < 0 || (value === null || value === void 0 ? void 0 : value.start) && ((_props_isDateUnavailable = props.isDateUnavailable) === null || _props_isDateUnavailable === void 0 ? void 0 : _props_isDateUnavailable.call(props, value.start)) || (value === null || value === void 0 ? void 0 : value.end) && ((_props_isDateUnavailable1 = props.isDateUnavailable) === null || _props_isDateUnavailable1 === void 0 ? void 0 : _props_isDateUnavailable1.call(props, value.end)));
1089
+ let validationState = props.validationState || (isValueInvalid ? "invalid" : null);
1073
1090
  return {
1074
1091
  value: value,
1075
1092
  setValue: setValue,
@@ -1109,6 +1126,7 @@ function $93c38a5e28be6249$export$e50a61c1de9f574(props) {
1109
1126
  overlayState.setOpen(isOpen);
1110
1127
  },
1111
1128
  validationState: validationState,
1129
+ isInvalid: isValueInvalid,
1112
1130
  formatValue (locale, fieldOptions) {
1113
1131
  if (!value || !value.start || !value.end) return null;
1114
1132
  let startTimeZone = "timeZone" in value.start ? value.start.timeZone : undefined;
@@ -1192,8 +1210,14 @@ function $eff5d8ee529ac4bb$export$fd53cef0cc796101(props) {
1192
1210
  let [value, setValue] = (0, $7UzoM$useControlledState)(props.value, props.defaultValue, props.onChange);
1193
1211
  let v = value || placeholderValue;
1194
1212
  let day = v && "day" in v ? v : undefined;
1195
- let placeholderDate = (0, $7UzoM$useMemo)(()=>$eff5d8ee529ac4bb$var$convertValue(placeholderValue), [
1196
- placeholderValue
1213
+ let defaultValueTimeZone = props.defaultValue && "timeZone" in props.defaultValue ? props.defaultValue.timeZone : undefined;
1214
+ let placeholderDate = (0, $7UzoM$useMemo)(()=>{
1215
+ let valueTimeZone = v && "timeZone" in v ? v.timeZone : undefined;
1216
+ return (valueTimeZone || defaultValueTimeZone) && placeholderValue ? (0, $7UzoM$toZoned)($eff5d8ee529ac4bb$var$convertValue(placeholderValue), valueTimeZone || defaultValueTimeZone) : $eff5d8ee529ac4bb$var$convertValue(placeholderValue);
1217
+ }, [
1218
+ placeholderValue,
1219
+ v,
1220
+ defaultValueTimeZone
1197
1221
  ]);
1198
1222
  let minDate = (0, $7UzoM$useMemo)(()=>$eff5d8ee529ac4bb$var$convertValue(minValue, day), [
1199
1223
  minValue,
@@ -1203,13 +1227,16 @@ function $eff5d8ee529ac4bb$export$fd53cef0cc796101(props) {
1203
1227
  maxValue,
1204
1228
  day
1205
1229
  ]);
1230
+ let timeValue = (0, $7UzoM$useMemo)(()=>value && "day" in value ? (0, $7UzoM$toTime)(value) : value, [
1231
+ value
1232
+ ]);
1206
1233
  let dateTime = (0, $7UzoM$useMemo)(()=>value == null ? null : $eff5d8ee529ac4bb$var$convertValue(value), [
1207
1234
  value
1208
1235
  ]);
1209
1236
  let onChange = (newValue)=>{
1210
- setValue(v && "day" in v ? newValue : newValue && (0, $7UzoM$toTime)(newValue));
1237
+ setValue(day || defaultValueTimeZone ? newValue : newValue && (0, $7UzoM$toTime)(newValue));
1211
1238
  };
1212
- return (0, $3c0fc76039f1c516$export$60e84778edff6d26)({
1239
+ let state = (0, $3c0fc76039f1c516$export$60e84778edff6d26)({
1213
1240
  ...props,
1214
1241
  value: dateTime,
1215
1242
  defaultValue: undefined,
@@ -1222,6 +1249,10 @@ function $eff5d8ee529ac4bb$export$fd53cef0cc796101(props) {
1222
1249
  // Calendar should not matter for time fields.
1223
1250
  createCalendar: ()=>new (0, $7UzoM$GregorianCalendar)()
1224
1251
  });
1252
+ return {
1253
+ ...state,
1254
+ timeValue: timeValue
1255
+ };
1225
1256
  }
1226
1257
  function $eff5d8ee529ac4bb$var$convertValue(value, date = (0, $7UzoM$today)((0, $7UzoM$getLocalTimeZone)())) {
1227
1258
  if (!value) return null;
package/dist/main.js CHANGED
@@ -173,7 +173,8 @@ function $aaab7a647e17e1fd$export$87194bb378cc3ac2(props) {
173
173
  if (selectedDate && newValue) commitValue(selectedDate, newValue);
174
174
  else setSelectedTime(newValue);
175
175
  };
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);
176
+ let isValueInvalid = props.isInvalid || props.validationState === "invalid" || (0, $50d5d6a623389320$export$eac50920cf2fd59a)(value, props.minValue, props.maxValue) || value && ((_props_isDateUnavailable = props.isDateUnavailable) === null || _props_isDateUnavailable === void 0 ? void 0 : _props_isDateUnavailable.call(props, value));
177
+ let validationState = props.validationState || (isValueInvalid ? "invalid" : null);
177
178
  return {
178
179
  value: value,
179
180
  setValue: setValue,
@@ -192,6 +193,7 @@ function $aaab7a647e17e1fd$export$87194bb378cc3ac2(props) {
192
193
  overlayState.setOpen(isOpen);
193
194
  },
194
195
  validationState: validationState,
196
+ isInvalid: isValueInvalid,
195
197
  formatValue (locale, fieldOptions) {
196
198
  if (!dateValue) return "";
197
199
  let formatOptions = (0, $50d5d6a623389320$export$7e319ea407e63bc0)(fieldOptions, {
@@ -706,6 +708,7 @@ function $596a1f0f523d6752$export$60e84778edff6d26(props) {
706
708
  let [validSegments, setValidSegments] = (0, $h2qOe$react.useState)(()=>props.value || props.defaultValue ? {
707
709
  ...allSegments
708
710
  } : {});
711
+ let clearedSegment = (0, $h2qOe$react.useRef)();
709
712
  // Reset placeholder when calendar changes
710
713
  let lastCalendarIdentifier = (0, $h2qOe$react.useRef)(calendar.identifier);
711
714
  (0, $h2qOe$react.useEffect)(()=>{
@@ -737,12 +740,20 @@ function $596a1f0f523d6752$export$60e84778edff6d26(props) {
737
740
  let displayValue = calendarValue && Object.keys(validSegments).length >= Object.keys(allSegments).length ? calendarValue : placeholderDate;
738
741
  let setValue = (newValue)=>{
739
742
  if (props.isDisabled || props.isReadOnly) return;
740
- if (Object.keys(validSegments).length >= Object.keys(allSegments).length) {
743
+ let validKeys = Object.keys(validSegments);
744
+ let allKeys = Object.keys(allSegments);
745
+ // if all the segments are completed or a timefield with everything but am/pm set the time, also ignore when am/pm cleared
746
+ if (newValue == null) {
747
+ setDate(null);
748
+ setPlaceholderDate((0, $50d5d6a623389320$export$66aa2b09de4b1ea5)(props.placeholderValue, granularity, calendar, defaultTimeZone));
749
+ setValidSegments({});
750
+ } else if (validKeys.length >= allKeys.length || validKeys.length === allKeys.length - 1 && allSegments.dayPeriod && !validSegments.dayPeriod && clearedSegment.current !== "dayPeriod") {
741
751
  // The display calendar should not have any effect on the emitted value.
742
752
  // Emit dates in the same calendar as the original value, if any, otherwise gregorian.
743
753
  newValue = (0, $h2qOe$internationalizeddate.toCalendar)(newValue, (v === null || v === void 0 ? void 0 : v.calendar) || new (0, $h2qOe$internationalizeddate.GregorianCalendar)());
744
754
  setDate(newValue);
745
755
  } else setPlaceholderDate(newValue);
756
+ clearedSegment.current = null;
746
757
  };
747
758
  let dateValue = (0, $h2qOe$react.useMemo)(()=>displayValue.toDate(timeZone), [
748
759
  displayValue,
@@ -793,10 +804,13 @@ function $596a1f0f523d6752$export$60e84778edff6d26(props) {
793
804
  let adjustSegment = (type, amount)=>{
794
805
  if (!validSegments[type]) {
795
806
  markValid(type);
796
- if (Object.keys(validSegments).length >= Object.keys(allSegments).length) setValue(displayValue);
807
+ let validKeys = Object.keys(validSegments);
808
+ let allKeys = Object.keys(allSegments);
809
+ if (validKeys.length >= allKeys.length || validKeys.length === allKeys.length - 1 && allSegments.dayPeriod && !validSegments.dayPeriod) setValue(displayValue);
797
810
  } else setValue($596a1f0f523d6752$var$addSegment(displayValue, type, amount, resolvedOptions));
798
811
  };
799
- let validationState = props.validationState || ((0, $50d5d6a623389320$export$eac50920cf2fd59a)(calendarValue, props.minValue, props.maxValue) ? "invalid" : null);
812
+ let isValueInvalid = props.isInvalid || props.validationState === "invalid" || (0, $50d5d6a623389320$export$eac50920cf2fd59a)(calendarValue, props.minValue, props.maxValue);
813
+ let validationState = props.validationState || (isValueInvalid ? "invalid" : null);
800
814
  var _props_maxGranularity1;
801
815
  return {
802
816
  value: calendarValue,
@@ -806,6 +820,7 @@ function $596a1f0f523d6752$export$60e84778edff6d26(props) {
806
820
  segments: segments,
807
821
  dateFormatter: dateFormatter,
808
822
  validationState: validationState,
823
+ isInvalid: isValueInvalid,
809
824
  granularity: granularity,
810
825
  maxGranularity: (_props_maxGranularity1 = props.maxGranularity) !== null && _props_maxGranularity1 !== void 0 ? _props_maxGranularity1 : "year",
811
826
  isDisabled: isDisabled,
@@ -842,6 +857,7 @@ function $596a1f0f523d6752$export$60e84778edff6d26(props) {
842
857
  },
843
858
  clearSegment (part) {
844
859
  delete validSegments[part];
860
+ clearedSegment.current = part;
845
861
  setValidSegments({
846
862
  ...validSegments
847
863
  });
@@ -1077,7 +1093,8 @@ function $7072d26f58deb33b$export$e50a61c1de9f574(props) {
1077
1093
  if ((dateRange === null || dateRange === void 0 ? void 0 : dateRange.start) && (dateRange === null || dateRange === void 0 ? void 0 : dateRange.end) && range.start && range.end) commitValue(dateRange, range);
1078
1094
  else setSelectedTimeRange(range);
1079
1095
  };
1080
- let validationState = props.validationState || (value != null && ((0, $50d5d6a623389320$export$eac50920cf2fd59a)(value.start, props.minValue, props.maxValue) || (0, $50d5d6a623389320$export$eac50920cf2fd59a)(value.end, props.minValue, props.maxValue) || value.end != null && value.start != null && value.end.compare(value.start) < 0 || (value === null || value === void 0 ? void 0 : value.start) && ((_props_isDateUnavailable = props.isDateUnavailable) === null || _props_isDateUnavailable === void 0 ? void 0 : _props_isDateUnavailable.call(props, value.start)) || (value === null || value === void 0 ? void 0 : value.end) && ((_props_isDateUnavailable1 = props.isDateUnavailable) === null || _props_isDateUnavailable1 === void 0 ? void 0 : _props_isDateUnavailable1.call(props, value.end))) ? "invalid" : null);
1096
+ let isValueInvalid = props.isInvalid || props.validationState === "invalid" || value != null && ((0, $50d5d6a623389320$export$eac50920cf2fd59a)(value.start, props.minValue, props.maxValue) || (0, $50d5d6a623389320$export$eac50920cf2fd59a)(value.end, props.minValue, props.maxValue) || value.end != null && value.start != null && value.end.compare(value.start) < 0 || (value === null || value === void 0 ? void 0 : value.start) && ((_props_isDateUnavailable = props.isDateUnavailable) === null || _props_isDateUnavailable === void 0 ? void 0 : _props_isDateUnavailable.call(props, value.start)) || (value === null || value === void 0 ? void 0 : value.end) && ((_props_isDateUnavailable1 = props.isDateUnavailable) === null || _props_isDateUnavailable1 === void 0 ? void 0 : _props_isDateUnavailable1.call(props, value.end)));
1097
+ let validationState = props.validationState || (isValueInvalid ? "invalid" : null);
1081
1098
  return {
1082
1099
  value: value,
1083
1100
  setValue: setValue,
@@ -1117,6 +1134,7 @@ function $7072d26f58deb33b$export$e50a61c1de9f574(props) {
1117
1134
  overlayState.setOpen(isOpen);
1118
1135
  },
1119
1136
  validationState: validationState,
1137
+ isInvalid: isValueInvalid,
1120
1138
  formatValue (locale, fieldOptions) {
1121
1139
  if (!value || !value.start || !value.end) return null;
1122
1140
  let startTimeZone = "timeZone" in value.start ? value.start.timeZone : undefined;
@@ -1200,8 +1218,14 @@ function $2654e87be0231a69$export$fd53cef0cc796101(props) {
1200
1218
  let [value, setValue] = (0, $h2qOe$reactstatelyutils.useControlledState)(props.value, props.defaultValue, props.onChange);
1201
1219
  let v = value || placeholderValue;
1202
1220
  let day = v && "day" in v ? v : undefined;
1203
- let placeholderDate = (0, $h2qOe$react.useMemo)(()=>$2654e87be0231a69$var$convertValue(placeholderValue), [
1204
- placeholderValue
1221
+ let defaultValueTimeZone = props.defaultValue && "timeZone" in props.defaultValue ? props.defaultValue.timeZone : undefined;
1222
+ let placeholderDate = (0, $h2qOe$react.useMemo)(()=>{
1223
+ let valueTimeZone = v && "timeZone" in v ? v.timeZone : undefined;
1224
+ return (valueTimeZone || defaultValueTimeZone) && placeholderValue ? (0, $h2qOe$internationalizeddate.toZoned)($2654e87be0231a69$var$convertValue(placeholderValue), valueTimeZone || defaultValueTimeZone) : $2654e87be0231a69$var$convertValue(placeholderValue);
1225
+ }, [
1226
+ placeholderValue,
1227
+ v,
1228
+ defaultValueTimeZone
1205
1229
  ]);
1206
1230
  let minDate = (0, $h2qOe$react.useMemo)(()=>$2654e87be0231a69$var$convertValue(minValue, day), [
1207
1231
  minValue,
@@ -1211,13 +1235,16 @@ function $2654e87be0231a69$export$fd53cef0cc796101(props) {
1211
1235
  maxValue,
1212
1236
  day
1213
1237
  ]);
1238
+ let timeValue = (0, $h2qOe$react.useMemo)(()=>value && "day" in value ? (0, $h2qOe$internationalizeddate.toTime)(value) : value, [
1239
+ value
1240
+ ]);
1214
1241
  let dateTime = (0, $h2qOe$react.useMemo)(()=>value == null ? null : $2654e87be0231a69$var$convertValue(value), [
1215
1242
  value
1216
1243
  ]);
1217
1244
  let onChange = (newValue)=>{
1218
- setValue(v && "day" in v ? newValue : newValue && (0, $h2qOe$internationalizeddate.toTime)(newValue));
1245
+ setValue(day || defaultValueTimeZone ? newValue : newValue && (0, $h2qOe$internationalizeddate.toTime)(newValue));
1219
1246
  };
1220
- return (0, $596a1f0f523d6752$export$60e84778edff6d26)({
1247
+ let state = (0, $596a1f0f523d6752$export$60e84778edff6d26)({
1221
1248
  ...props,
1222
1249
  value: dateTime,
1223
1250
  defaultValue: undefined,
@@ -1230,6 +1257,10 @@ function $2654e87be0231a69$export$fd53cef0cc796101(props) {
1230
1257
  // Calendar should not matter for time fields.
1231
1258
  createCalendar: ()=>new (0, $h2qOe$internationalizeddate.GregorianCalendar)()
1232
1259
  });
1260
+ return {
1261
+ ...state,
1262
+ timeValue: timeValue
1263
+ };
1233
1264
  }
1234
1265
  function $2654e87be0231a69$var$convertValue(value, date = (0, $h2qOe$internationalizeddate.today)((0, $h2qOe$internationalizeddate.getLocalTimeZone)())) {
1235
1266
  if (!value) return null;