Skip to content

Commit

Permalink
The addDaysToDate function should not modify the original date. (#96)
Browse files Browse the repository at this point in the history
* addDaysToDate

* removed the commented code

* removed date format and return null when new date is not a function

* Code improvements

---------

Co-authored-by: Hero <[email protected]>
Co-authored-by: Samuel Male <[email protected]>
  • Loading branch information
3 people authored Jul 10, 2023
1 parent ef9a1d2 commit 109c10f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/utils/common-expression-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ export class CommonExpressionHelpers {
return date;
};

addDaysToDate = (date, days) => {
date.setDate(date.getDate() + days);

return date;
addDaysToDate = (date: Date, days: number): Date => {
return dayjs(date)
.add(days, 'day')
.toDate();
};

useFieldValue = (questionId: string) => {
Expand Down

0 comments on commit 109c10f

Please sign in to comment.