date-fran
Version:
Date functionalities for javascript projects.
37 lines (36 loc) • 1.78 kB
TypeScript
/**
* Think of the function as saying; future date should be greater than past date.
* If both dates are same, the function returns false; implying that the future date
* exceedes the other.
* @param pastDate: string or Date data type. string must follow the format YYYY-MM-DD or YYYY/MM/DD
* @param futureDate: string or Date data type. string must follow the format YYYY-MM-DD or YYYY/MM/DD
* @returns true if future date is greater than past date
*/
export declare const varyingDatesComparator: (pastDate: string | Date, futureDate: string | Date) => boolean;
/**
* Imagine the function saying; both dates are equal
* @param firstDate can be of the form "YYYY-MM-DD", "YYYY/MM/DD" or "Sun Sep 11 2022"
* @param secondDate can be of the form "YYYY-MM-DD", "YYYY/MM/DD" or "Wed Oct 05 2021"
* @returns true if both dates are equal. Otherwise, false
*/
export declare const sameDateComparator: (firstDate: string | Date, secondDate: string | Date) => boolean;
/**
* This function says; I'll give you yesterdays' date corresponidng to the given
* date you give me.
* @param dateData a date-data of the form "YYYY-MM-DD", "YYYY/MM/DD" or "YYY-MM-DDTHH:mm:ss.000Z"
* @returns
*/
export declare const yesterdaysDateByGivenDate: (dateData: string) => Date;
/**
* This function says; I'll give you tomorrows' date corresponidng to the given
* date you give me.
* @param dateData a date-data of the form "YYYY-MM-DD", "YYYY/MM/DD" or "YYY-MM-DDTHH:mm:ss.000Z"
* @returns
*/
export declare const tomorrowsDateByGivenDate: (dateData: string | Date) => Date;
/**
* convert dates of the format: Mon Oct 17 2022; to actual date types
* @param dateString
* @returns
*/
export declare const dateStringToDate: (dateString: string) => Date | "Invalid date argument";