mirror of
https://github.com/status-im/spiff-arena.git
synced 2025-02-07 07:34:17 +00:00
do not blow up if the date is a bad format in a react json schema form w/ burnettk
This commit is contained in:
parent
2c9b3bf415
commit
18f5c68e3e
@ -100,12 +100,15 @@ export default function BaseInputTemplate<
|
|||||||
if (type === 'date') {
|
if (type === 'date') {
|
||||||
// display the date in a date input box as the config wants.
|
// display the date in a date input box as the config wants.
|
||||||
// it should in be y-m-d when it gets here.
|
// it should in be y-m-d when it gets here.
|
||||||
let dateValue: string | null = '';
|
let dateValue: string | null = value;
|
||||||
if (value || value === 0) {
|
if (value || value === 0) {
|
||||||
if (value.length < 10) {
|
if (value.length < 10) {
|
||||||
dateValue = value;
|
dateValue = value;
|
||||||
} else {
|
} else {
|
||||||
|
try {
|
||||||
dateValue = ymdDateStringToConfiguredFormat(value);
|
dateValue = ymdDateStringToConfiguredFormat(value);
|
||||||
|
// let the date component and form validators handle bad dates and do not blow up
|
||||||
|
} catch (RangeError) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user