1// ââ A TIME ON THE DESK, IN THE VIEWER'S PROFILE ZONE (app-0040 cluster 9, Amir's ruling T1) ââââ 2// 3// The server renders every desk time through `Support::DeskTime.format` in the supporter's profile 4// zone; a row that arrives over the socket is rendered HERE, from the row's full instant 5// (`at_iso`), in the zone the page was rendered for (`data-desk-zone` on the chat mount). Not the 6// browser's zone: supporters work over the company VPN, and the zone their browser reports is 7// wrong for every one of them. 8// 9// â EXACTLY THE SERVER'S SHAPE, `short_month_day_comma_time` in English: "Sep 28, 12:00" â the 10// English month abbreviation, the day with no leading zero, a comma, a 24-hour clock. The month 11// comes from this file's own list rather than from `Intl`'s "short" month, because `Intl` spells 12// September "Sept" in some English locales, and the live row and its reload have to be one string. 13const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] 14 15function partsIn(date, zone) { 16 const options = { year: "numeric", month: "numeric", day: "numeric", hour: "2-digit", 17 minute: "2-digit", hourCycle: "h23" } 18 try { 19 return new Intl.DateTimeFormat("en-US", { ...options, timeZone: zone || "UTC" }).formatToParts(date) 20 } catch (e) { 21 // A zone this browser does not know reads UTC, which is also what the server falls back to. 22 return new Intl.DateTimeFormat("en-US", { ...options, timeZone: "UTC" }).formatToParts(date) 23 } 24} 25 26// "Sep 28, 12:00", or null for an instant that does not parse â the caller then keeps whatever 27// the payload's own short form says rather than printing "Invalid Date". 28export function formatDeskTime(iso, zone) { 29 if (!iso) return null 30 const date = new Date(iso) 31 if (Number.isNaN(date.getTime())) return null 32 const part = {} 33 for (const p of partsIn(date, zone)) part[p.type] = p.value
34 const month = MONTHS[Number(part.month) - 1] 35 if (!month) return null 36 return `${month} ${Number(part.day)}, ${part.hour}:${part.minute}` 37}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.