-
-
Notifications
You must be signed in to change notification settings - Fork 92
Expand file tree
/
Copy pathtime.ts
More file actions
24 lines (20 loc) · 520 Bytes
/
time.ts
File metadata and controls
24 lines (20 loc) · 520 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import {
type CalendarDate,
getLocalTimeZone,
now as realNow,
today as realToday,
type ZonedDateTime,
} from "@internationalized/date";
export const today = (): CalendarDate => {
return realToday(getLocalTimeZone());
};
export const now = (): ZonedDateTime => {
return realNow(getLocalTimeZone());
};
export const timezone = (): string => {
return getLocalTimeZone();
};
const millisInSecond = 1000;
export const secondsToMillis = (seconds: number): number => {
return seconds * millisInSecond;
};