Handle invalid date
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
nemunaire 2022-09-16 13:44:18 +02:00
parent 7f7561ad3e
commit 9351b39a4b

View File

@ -12,7 +12,12 @@
let internal;
const input = (x) => (internal = dayjs(x).format(format));
const output = (x) => (date = dayjs(x, format).toDate().toISOString());
const output = (x) => {
const d = dayjs(x, format).toDate();
if (d) {
date = d.toISOString();
}
};
$: input(date)
$: output(internal)