Skip to content

Commit

Permalink
comments for getDate method
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulramesha committed Mar 18, 2024
1 parent 5a90cc0 commit f7dc1c7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions web/helpers/date-time.helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@ export const checkIfDatesAreEqual = (
return isEqual(parsedDate1, parsedDate2);
};

/**
* This method returns a date from string of type yyyy-mm-dd
* This method is recommended to use instead of new Date() as this does not introduce any timezone offsets
* @param date
* @returns date or undefined
*/
export const getDate = (date: string | Date | undefined | null): Date | undefined => {
if (!date || date === "") return;

Expand Down

0 comments on commit f7dc1c7

Please sign in to comment.