MCPcopy Create free account
hub / github.com/triggerdotdev/trigger.dev / formatDate

Function formatDate

apps/webapp/app/routes/admin.api.v1.snapshot.ts:10–24  ·  view source on GitHub ↗
(date: Date)

Source from the content-addressed store, hash-verified

8
9// Format date as yyyy-MM-dd HH_mm_ss_SSS
10function formatDate(date: Date) {
11 const year = date.getFullYear();
12 const month = date.getMonth() + 1;
13 const day = date.getDate();
14 const hours = date.getHours();
15 const minutes = date.getMinutes();
16 const seconds = date.getSeconds();
17 const milliseconds = date.getMilliseconds();
18
19 return `${year}-${month.toString().padStart(2, "0")}-${day.toString().padStart(2, "0")} ${hours
20 .toString()
21 .padStart(2, "0")}_${minutes.toString().padStart(2, "0")}_${seconds
22 .toString()
23 .padStart(2, "0")}_${milliseconds.toString().padStart(3, "0")}`;
24}
25
26export async function loader({ request }: DataFunctionArgs) {
27 const user = await requireUser(request);

Callers 1

loaderFunction · 0.85

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…