Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 43x 26x 17x 186x 63x 63x 63x 65x 2x 63x 63x 63x 63x | import { format, add } from "date-fns"; export function formatDate(date: number | null | undefined) { if (!date || date === undefined) { return "Pending"; } return format(date, "MMMM d, yyyy"); } export const isDST = (date: Date): boolean => { const jan = new Date(date).getTimezoneOffset(); const jul = new Date(new Date(date).setMonth(6)).getTimezoneOffset(); return new Date(date).getTimezoneOffset() < Math.max(jan, jul); }; export function formatNinetyDaysDate(date: number | null | undefined): string { if (!date) { return "Pending"; } const baseDate = new Date(date); const ninetyDaysLater = add(baseDate, { days: 90 }); const timezoneAbbreviation = isDST(ninetyDaysLater) ? "EDT" : "EST"; return format(ninetyDaysLater, `MMM d, yyyy '@ 11:59pm ${timezoneAbbreviation}'`); } |