Skip to content

Commit

Permalink
fix: check return value of parseDate
Browse files Browse the repository at this point in the history
  • Loading branch information
superskip committed Oct 1, 2024
1 parent 85b29fb commit 2402f1b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/core_modules/capture-core/converters/formToClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ function convertDateTime(formValue: DateTimeValue): string {
}

function convertDate(dateValue: string) {
const parsedDate = parseDate(dateValue);
// $FlowFixMe[incompatible-use] automated comment
return parseDate(dateValue).momentDate.toISOString();
return parsedDate.isValid ? parsedDate.momentDate.toISOString() : null;
}

function convertTime(timeValue: string) {
Expand Down

0 comments on commit 2402f1b

Please sign in to comment.