diff --git a/code/addons/interactions/src/components/MethodCall.stories.tsx b/code/addons/interactions/src/components/MethodCall.stories.tsx index 1ab027dd5dec..929c0c7c9587 100644 --- a/code/addons/interactions/src/components/MethodCall.stories.tsx +++ b/code/addons/interactions/src/components/MethodCall.stories.tsx @@ -71,6 +71,7 @@ export const Args = () => ( /> + { - const [date, time, ms] = value.split(/[T.Z]/); +export const DateNode = ({ value }: { value: string | Date }) => { + let parsed = new Date(value); + if (isNaN(+parsed)) { + logger.warn('Invalid date value:', value); + parsed = null; + } + const colors = useThemeColors(); + if (!parsed) { + return Invalid date; + } + + const [date, time, ms] = parsed.toISOString().split(/[T.Z]/); return ( {date}