diff --git a/packages/datetime/src/components/DateTimeRangeFloatingPicker/DateTimeRangeFloatingPicker.tsx b/packages/datetime/src/components/DateTimeRangeFloatingPicker/DateTimeRangeFloatingPicker.tsx index 6d25fe92..27aff9fe 100644 --- a/packages/datetime/src/components/DateTimeRangeFloatingPicker/DateTimeRangeFloatingPicker.tsx +++ b/packages/datetime/src/components/DateTimeRangeFloatingPicker/DateTimeRangeFloatingPicker.tsx @@ -104,7 +104,6 @@ export const DateTimeRangeFloatingPicker: React.FC< const { inputValue, inputOnChange, errors, updateValue } = useDateTimeRangeInputValidation({ value: tmpValue, - // onChange: setValue, onChange: (range) => { setMonthDate(tryParseDate(parseDate)(range[0])); if (autoApply) { @@ -113,8 +112,9 @@ export const DateTimeRangeFloatingPicker: React.FC< setTmpValue(range); } }, - reprDate: formatDate, - parseDate: parseStrDate, + //reprDate: formatDate, + reprDate: (ts: number) => formatDate(ts), + parseDate, }); return ( @@ -124,7 +124,13 @@ export const DateTimeRangeFloatingPicker: React.FC< id={`${id}__popover`} isOpened={isOpened} placement={placement} - onClose={onCloseCallback} + onClose={() => { + setTmpValue(value); + updateValue(value); + if (onCloseCallback) { + onCloseCallback(); + } + }} > {({ ref, setOpened }) => (
@@ -191,6 +197,12 @@ export const DateTimeRangeFloatingPicker: React.FC< , diff --git a/packages/datetime/src/components/DateTimeRangeInput/DateTimeRangeInput.tsx b/packages/datetime/src/components/DateTimeRangeInput/DateTimeRangeInput.tsx index f1e008d7..e2ade88c 100644 --- a/packages/datetime/src/components/DateTimeRangeInput/DateTimeRangeInput.tsx +++ b/packages/datetime/src/components/DateTimeRangeInput/DateTimeRangeInput.tsx @@ -156,7 +156,7 @@ export const DateTimeRangeInput: React.FC = ({ size={size} status={statuses[0]} style={cssDateTimeRangeInput({ size, status: statuses[0] })} - value={value[0]} + value={value[0] ?? ''} /> = ({ size={size} status={statuses[1]} style={cssDateTimeRangeInput({ size, status: statuses[1] })} - value={value[1]} + value={value[1] ?? ''} /> {hasRealTime(realTime) && ( diff --git a/packages/datetime/src/components/DateTimeRangeInput/helpers.ts b/packages/datetime/src/components/DateTimeRangeInput/helpers.ts index 65dff268..e90b6fe3 100644 --- a/packages/datetime/src/components/DateTimeRangeInput/helpers.ts +++ b/packages/datetime/src/components/DateTimeRangeInput/helpers.ts @@ -21,10 +21,13 @@ export const cssDateTimeRangeInput = ({ height: ${rangeControlInputTokens.size.height[size]}; padding: ${rangeControlInputTokens.space.padding[size]}; - &:focus { - box-shadow: inset - ${rangeControlTokens.elevation.boxShadow[status].focused}; - } + ${hasStatus && + css` + &:focus { + box-shadow: inset + ${rangeControlTokens.elevation.boxShadow[status].focused}; + } + `} `; }}; `;