Skip to content

Commit

Permalink
fix: error when date is null result in runtime error
Browse files Browse the repository at this point in the history
  • Loading branch information
alaa-yahia committed Nov 26, 2024
1 parent ecde8c9 commit 2fe76aa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core_modules/capture-core/converters/formToClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ function convertDateTime(formValue: DateTimeValue): ?string {
const hours = momentTime.hour();
const minutes = momentTime.minute();

const parsedDate = parseDate(editedDate);
if (!parsedDate.isValid) return null;
const parsedDate = editedDate ? parseDate(editedDate) : null;
if (!(parsedDate && parsedDate.isValid)) return null;
// $FlowFixMe[incompatible-type] automated comment
const momentDateTime: moment$Moment = parsedDate.momentDate;
momentDateTime.hour(hours);
Expand Down

0 comments on commit 2fe76aa

Please sign in to comment.