refactor: throw an error object instead of string

This commit is contained in:
Corentin Thomasset 2022-04-16 21:21:47 +02:00
parent a14cac6d5c
commit 4112fa532e
No known key found for this signature in database
GPG key ID: DBD997E935996158

View file

@ -73,7 +73,7 @@ function onDateInputChanged(value: string) {
const formatted: Date | string = toDate(value) const formatted: Date | string = toDate(value)
if (!isDate(formatted) || isNaN(formatted.getTime())) { if (!isDate(formatted) || isNaN(formatted.getTime())) {
throw 'invalid date' throw new Error('Invalid date')
} }
baseDate.value = formatted baseDate.value = formatted