mirror of
https://github.com/expo/appjs25-eas-update-workshop-code.git
synced 2026-11-14 17:48:09 -10:00
15 lines
515 B
TypeScript
15 lines
515 B
TypeScript
// Date-time utils for the persistent date hook and for date comparison
|
|
|
|
export const date1GreaterThanDate2 = (
|
|
date1: Date | undefined,
|
|
date2: Date | undefined,
|
|
) => dateToTimeInMilliSeconds(date1) > dateToTimeInMilliSeconds(date2);
|
|
|
|
const dateToTimeInMilliSeconds = (date: Date | undefined) =>
|
|
date ? Math.floor(date.getTime()) : -1;
|
|
|
|
export const dateDifferenceInMilliSeconds = (
|
|
date1: Date | undefined,
|
|
date2: Date | undefined,
|
|
) => dateToTimeInMilliSeconds(date1) - dateToTimeInMilliSeconds(date2);
|