Open sssaha opened 7 hours ago
hi @sssaha It doesn't look like the datetime picker in Mantine supports milliseconds
@sssaha Actually, it looks like it could be supported.
The date is converted to datestring here and it excludes the milliseconds
https://github.com/snehilvj/dash-mantine-components/blob/master/src/ts/utils/dates.ts#L15
// convert to datetime string for dash
export const datetimeToString = (d: DateValue) => {
return d ? dayjs(d).format("YYYY-MM-DD HH:mm:ss") : null;
};
In the DateTimePicker
, when the value
changes, it calls the function above
https://github.com/snehilvj/dash-mantine-components/blob/master/src/ts/components/dates/DateTimePicker.tsx#L69
useDidUpdate(() => {
setDate(stringToDate(value));
}, [value]);
We could probably add a new prop withMilliseconds
and to convert to a datestring with milliseconds. Adding this new prop would make it so it's not a breaking change.
I have a DMC Datetimepicker which in the example is initialized with the current datetime. When done - it retains the milisecond. I also have a button that can then set the time. But doing this way - it seems like the value does not retain the milisecond anymore..
MRE:
During First Load After pressing button