Invalid date exception handling #2656
-
Hi , If I input invalid date time value, e.g. 23/13/2023, it will only throw Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 6 replies
-
The errors are described in the docs. Each has a "code" you can look for. If you need to handle None US dates see the custom date format plugin |
Beta Was this translation helpful? Give feedback.
-
Is there a particular pattern for catching these errors?
...but that never seems to get caught. Other than that I can catch this at a window level ( |
Beta Was this translation helpful? Give feedback.
-
Here is a hacky method involving overriding the parseInput function that worked for my use case: date.dates.oldParseInput=date.dates.parseInput;
date.dates.parseInput=(input)=>{
try{
return date.dates.oldParseInput(input);
}
catch(err){
date.dates.clear();
}
}; Technically the documentation does say you can override the parseInput method. |
Beta Was this translation helpful? Give feedback.
-
This is done in 6.9.4 |
Beta Was this translation helpful? Give feedback.
This is done in 6.9.4