fix: correct precision conversion error for Unix timestamp in readPretty (#4569)

This commit is contained in:
Katherine 2024-06-06 09:27:57 +08:00 committed by GitHub
parent 361ebee130
commit 74a5090ae8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -43,7 +43,7 @@ interface UnixTimestampProps {
export const UnixTimestamp = connect(
(props: UnixTimestampProps) => {
const { value, onChange, accuracy = 'second' } = props;
const v = useMemo(() => toValue(value, accuracy), [value]);
const v = useMemo(() => toValue(value, accuracy), [value, accuracy]);
return (
<DatePicker
{...props}
@ -57,8 +57,8 @@ export const UnixTimestamp = connect(
);
},
mapReadPretty((props) => {
const { value, accuracy } = props;
const v = useMemo(() => toValue(value, accuracy), [value]);
const { value, accuracy = 'second' } = props;
const v = useMemo(() => toValue(value, accuracy), [value, accuracy]);
return <DatePicker.ReadPretty {...props} value={v} />;
}),
);