Files
Stirling-PDF/frontend/src/saas/components/shared/utils/date.ts
T
James BruntonandGitHub fa8c52b2be Add SaaS frontend code (#5879)
# Description of Changes
Adds the code for the SaaS frontend as proprietary code to the OSS repo.
This version of the code is adapted from 22/1/2026, which was the last
SaaS version based on the 'V2' design. This will move us closer to being
able to have the OSS products understand whether the user has a SaaS
account, and provide the correct UI in those cases.
2026-03-11 11:53:54 +00:00

15 lines
438 B
TypeScript

export function formatUTC(iso: string, withTime: boolean): string {
const date = new Date(iso);
if (Number.isNaN(date.getTime())) return "-";
const formatted = new Intl.DateTimeFormat("en-US", {
month: "short",
day: "numeric",
year: "numeric",
...(withTime ? { hour: "2-digit", minute: "2-digit", hour12: false } : {}),
timeZone: "UTC",
}).format(date);
return withTime ? `${formatted} UTC` : formatted;
}