Skip to content

Commit

Permalink
9995: handle invalid dates
Browse files Browse the repository at this point in the history
  • Loading branch information
nechama-krigsman committed Sep 18, 2023
1 parent 7688d57 commit 51afe4c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions web-client/src/presenter/actions/formatDateFromDatePicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ export const formatDateFromDatePicker = ({
| undefined => {
if (props.value) {
const [month, day, year] = props.value.split('/');
const formattedMonth = month.length === 1 ? `0${month}` : month;
const formattedDay = day.length === 1 ? `0${day}` : day;

const formattedMonth = month?.length === 1 ? `0${month}` : month;
const formattedDay = day?.length === 1 ? `0${day}` : day;

const zeroPaddedDate = `${formattedMonth}/${formattedDay}/${year}`;

Expand Down

0 comments on commit 51afe4c

Please sign in to comment.