my-website-v2/frontend/lib/convertUtc.ts

15 lines
420 B
TypeScript
Raw Normal View History

2024-12-02 17:29:45 -06:00
export const convertUtc = (utcTimestamp: string): string => {
const utcTimeZone: string = Intl.DateTimeFormat().resolvedOptions().timeZone;
return new Date(utcTimestamp).toLocaleString("en-US", {
day: "numeric",
month: "numeric",
year: "numeric",
hour: "numeric",
minute: "numeric",
hourCycle: "h24",
timeZone: utcTimeZone,
});
};
const validateTime = (parsedUtcTimestamp: any) => {};