gsr
01/08/2024, 7:40 PMTim
01/08/2024, 7:44 PMparseEuroDate doesn't check that euroDate is a valid date before is calls LSParseDateTime so that throws an error on the invalid values.Tim
01/08/2024, 7:47 PMTim
01/08/2024, 7:50 PMtry {
var startDate = parseEuroDate(startEuroDate);
var endDate = parseEuroDate(endEuroDate);
}
catch( any error ) {
return "Error: Invalid date format.";
}gsr
01/08/2024, 7:52 PMgsr
01/08/2024, 7:53 PMTim
01/08/2024, 7:56 PMstartEuroDate and endEuroDate are dates until after you have attempted to convert them to date types.Tim
01/08/2024, 7:57 PMisUsefulDate checks if startDate and endDate are dates... But they have to be dates, because parseEuroDate returns a date.gsr
01/08/2024, 7:59 PMTim
01/08/2024, 7:59 PMIsDate check needs to move into parseEuroDate instead. But even then, it wouldn't actually solve the problem because "12/23/2023" would pass an IsDate check. But still cause LSParseDateTime to throw an error, since it's not a valid UK date.Tim
01/08/2024, 8:00 PMIsDate check, and checking the exception is probably the easiest way to handle this.gsr
01/08/2024, 8:01 PMgsr
01/08/2024, 8:01 PMTim
01/08/2024, 8:02 PMTim
01/08/2024, 8:05 PMgsr
01/08/2024, 8:07 PMgsr
01/08/2024, 8:07 PMTim
01/08/2024, 8:16 PMvar startYear = year(startDate) because "45/45/2023" is not a date, no matter what format you're using.Tim
01/08/2024, 8:20 PMTim
01/08/2024, 8:23 PMgsr
01/09/2024, 12:39 PM