utils/ts-src/getDays.ts
Martin Donnelly 95caba340a * Updated packages
* Added getHours function
2021-05-16 22:20:46 +01:00

15 lines
337 B
TypeScript

/**
* Get number of days between two Date objects
* @param startdate
* @param enddate
*/
export function getDays(startdate: Date, enddate: Date): number {
let result, startMS, endMS;
startMS = startdate.getTime();
endMS = enddate.getTime();
result = Math.ceil((endMS - startMS) / (24 * 60 * 60 * 1000));
return result;
}