Openstatus www.openstatus.dev
at main 22 lines 539 B view raw
1/** 2 * Format cron timestamp (epoch ms) to ISO string 3 * 4 * @example 5 * formatTimestamp(1737553800000) // "2026-01-22T14:30:00.000Z" 6 * 7 * @param cronTimestamp - Epoch timestamp in milliseconds 8 * @returns Formatted timestamp string to ISO string 9 */ 10export function formatTimestamp(cronTimestamp: number): string { 11 if (!cronTimestamp || !Number.isFinite(cronTimestamp)) { 12 return "Unknown"; 13 } 14 15 const date = new Date(cronTimestamp); 16 17 if (Number.isNaN(date.getTime())) { 18 return "Unknown"; 19 } 20 21 return date.toISOString(); 22}