comments for getDate method

This commit is contained in:
rahulramesha 2024-03-18 13:00:05 +05:30
parent 5a90cc0ccd
commit f7dc1c7877

View File

@ -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;