@flamingo-stack/openframe-frontend-core 0.0.642 → 0.0.643-snapshot.20260916153353

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/dist/chat-protocol/index.cjs +6 -3
  2. package/dist/chat-protocol/index.cjs.map +1 -1
  3. package/dist/chat-protocol/index.js +6 -3
  4. package/dist/chat-protocol/index.js.map +1 -1
  5. package/dist/chat-protocol/source-metadata.d.ts +16 -1
  6. package/dist/chat-protocol/source-metadata.d.ts.map +1 -1
  7. package/dist/{chunk-YM6L3WM5.js → chunk-27RD5XTP.js} +3 -3
  8. package/dist/{chunk-POPL3W2S.js → chunk-3DGRXC74.js} +3 -3
  9. package/dist/{chunk-2Z5FPHOL.cjs → chunk-3UBT2OIX.cjs} +20 -20
  10. package/dist/{chunk-2Z5FPHOL.cjs.map → chunk-3UBT2OIX.cjs.map} +1 -1
  11. package/dist/{chunk-6GY6DFIH.js → chunk-4WVWRFGP.js} +6 -6
  12. package/dist/{chunk-OYI3K5R6.cjs → chunk-65EVGKFV.cjs} +8 -14
  13. package/dist/chunk-65EVGKFV.cjs.map +1 -0
  14. package/dist/{chunk-6NHLZORM.js → chunk-7Q5XXPCB.js} +6 -6
  15. package/dist/{chunk-2NRLRRMR.cjs → chunk-7R2DIGG4.cjs} +319 -293
  16. package/dist/chunk-7R2DIGG4.cjs.map +1 -0
  17. package/dist/{chunk-3LXJEXPH.js → chunk-B3Z3RJRW.js} +2 -2
  18. package/dist/{chunk-N5C5P2LM.cjs → chunk-B5IFXCRF.cjs} +22 -22
  19. package/dist/{chunk-N5C5P2LM.cjs.map → chunk-B5IFXCRF.cjs.map} +1 -1
  20. package/dist/{chunk-YRSRP4U3.cjs → chunk-C5Y5T6GC.cjs} +15 -15
  21. package/dist/{chunk-YRSRP4U3.cjs.map → chunk-C5Y5T6GC.cjs.map} +1 -1
  22. package/dist/{chunk-VHB3I6F3.cjs → chunk-CBXZSTAG.cjs} +419 -445
  23. package/dist/chunk-CBXZSTAG.cjs.map +1 -0
  24. package/dist/{chunk-VKPTN5MT.cjs → chunk-DCCY54LU.cjs} +6 -6
  25. package/dist/{chunk-VKPTN5MT.cjs.map → chunk-DCCY54LU.cjs.map} +1 -1
  26. package/dist/{chunk-WL3PNUNY.cjs → chunk-FAD5WURS.cjs} +81 -81
  27. package/dist/{chunk-WL3PNUNY.cjs.map → chunk-FAD5WURS.cjs.map} +1 -1
  28. package/dist/{chunk-3IPL6G7S.js → chunk-FOSIR4QF.js} +260 -234
  29. package/dist/chunk-FOSIR4QF.js.map +1 -0
  30. package/dist/{chunk-MJ424FEC.js → chunk-HOGOQA2X.js} +2 -2
  31. package/dist/{chunk-SDGMLXIP.js → chunk-HPWLIYRL.js} +12 -25
  32. package/dist/chunk-HPWLIYRL.js.map +1 -0
  33. package/dist/{chunk-3I6XHQUD.js → chunk-I57XLISO.js} +54 -80
  34. package/dist/chunk-I57XLISO.js.map +1 -0
  35. package/dist/{chunk-FRCUUK5X.cjs → chunk-IIXB5REN.cjs} +3 -3
  36. package/dist/{chunk-FRCUUK5X.cjs.map → chunk-IIXB5REN.cjs.map} +1 -1
  37. package/dist/{chunk-HW7BLVQH.js → chunk-IXD6SHQ6.js} +4 -4
  38. package/dist/{chunk-XFLJC2WR.cjs → chunk-LZYPSDFE.cjs} +59 -59
  39. package/dist/{chunk-XFLJC2WR.cjs.map → chunk-LZYPSDFE.cjs.map} +1 -1
  40. package/dist/{chunk-QY25ZP2V.cjs → chunk-MCQAOIUK.cjs} +28 -28
  41. package/dist/{chunk-QY25ZP2V.cjs.map → chunk-MCQAOIUK.cjs.map} +1 -1
  42. package/dist/{chunk-S254VEDE.js → chunk-MRIOYSXH.js} +3 -3
  43. package/dist/{chunk-OOOOC5O5.cjs → chunk-OMSUWB6A.cjs} +29 -29
  44. package/dist/{chunk-OOOOC5O5.cjs.map → chunk-OMSUWB6A.cjs.map} +1 -1
  45. package/dist/{chunk-GEIHTN6J.cjs → chunk-OVXYX47B.cjs} +10 -10
  46. package/dist/{chunk-GEIHTN6J.cjs.map → chunk-OVXYX47B.cjs.map} +1 -1
  47. package/dist/{chunk-XWGHLSAL.js → chunk-PFV4DAX5.js} +4 -4
  48. package/dist/{chunk-O4LL7RQV.cjs → chunk-RB6L5EGM.cjs} +208 -221
  49. package/dist/chunk-RB6L5EGM.cjs.map +1 -0
  50. package/dist/{chunk-M4PJVFBF.cjs → chunk-RFFF2EYD.cjs} +11 -11
  51. package/dist/{chunk-M4PJVFBF.cjs.map → chunk-RFFF2EYD.cjs.map} +1 -1
  52. package/dist/{chunk-UFBWNVZZ.js → chunk-RNMGKAS6.js} +7 -7
  53. package/dist/{chunk-SE6YRE3R.cjs → chunk-RWURXICE.cjs} +32 -32
  54. package/dist/{chunk-SE6YRE3R.cjs.map → chunk-RWURXICE.cjs.map} +1 -1
  55. package/dist/{chunk-ZAIYD3MZ.js → chunk-S2KMNFFN.js} +3 -3
  56. package/dist/{chunk-ZGPJ3NVF.js → chunk-SKABQX44.js} +3 -3
  57. package/dist/{chunk-YE3TFNW6.cjs → chunk-TGUA3C4U.cjs} +5 -5
  58. package/dist/{chunk-YE3TFNW6.cjs.map → chunk-TGUA3C4U.cjs.map} +1 -1
  59. package/dist/{chunk-ORFJVMAL.js → chunk-TTVOBWAH.js} +5 -11
  60. package/dist/chunk-TTVOBWAH.js.map +1 -0
  61. package/dist/{chunk-M7QROULE.js → chunk-UEXIMEVU.js} +5 -5
  62. package/dist/{chunk-EW3MSJOE.cjs → chunk-UKV52KAP.cjs} +33 -33
  63. package/dist/{chunk-EW3MSJOE.cjs.map → chunk-UKV52KAP.cjs.map} +1 -1
  64. package/dist/{chunk-J4RZVLLQ.js → chunk-VE52MSYC.js} +5 -5
  65. package/dist/components/case-studies/index.cjs +16 -16
  66. package/dist/components/case-studies/index.js +4 -4
  67. package/dist/components/chat/chat-sidebar.d.ts.map +1 -1
  68. package/dist/components/chat/entity-cards/blog-card.d.ts.map +1 -1
  69. package/dist/components/chat/entity-cards/dispatch.d.ts.map +1 -1
  70. package/dist/components/chat/entity-cards/program-card.d.ts.map +1 -1
  71. package/dist/components/chat/index.cjs +3 -9
  72. package/dist/components/chat/index.cjs.map +1 -1
  73. package/dist/components/chat/index.js +2 -8
  74. package/dist/components/chat/types/entities/investor-update.d.ts.map +1 -1
  75. package/dist/components/chat/types/entities/program-types.d.ts +8 -18
  76. package/dist/components/chat/types/entities/program-types.d.ts.map +1 -1
  77. package/dist/components/chat/utils/compact-card-classes.d.ts.map +1 -1
  78. package/dist/components/contact/index.cjs +5 -5
  79. package/dist/components/contact/index.js +4 -4
  80. package/dist/components/docs/index.cjs +8 -8
  81. package/dist/components/docs/index.js +7 -7
  82. package/dist/components/embeds/index.cjs +5 -5
  83. package/dist/components/embeds/index.js +4 -4
  84. package/dist/components/faq/index.cjs +5 -5
  85. package/dist/components/faq/index.js +4 -4
  86. package/dist/components/features/index.cjs +4 -4
  87. package/dist/components/features/index.js +3 -3
  88. package/dist/components/help-center-pages/index.cjs +24 -24
  89. package/dist/components/help-center-pages/index.js +15 -15
  90. package/dist/components/index.cjs +53 -59
  91. package/dist/components/index.cjs.map +1 -1
  92. package/dist/components/index.js +15 -21
  93. package/dist/components/index.js.map +1 -1
  94. package/dist/components/logs-list.d.ts.map +1 -1
  95. package/dist/components/meeting-scheduler/confirmation.d.ts.map +1 -1
  96. package/dist/components/meeting-scheduler/directory.d.ts.map +1 -1
  97. package/dist/components/meeting-scheduler/index.cjs +47 -72
  98. package/dist/components/meeting-scheduler/index.cjs.map +1 -1
  99. package/dist/components/meeting-scheduler/index.d.ts.map +1 -1
  100. package/dist/components/meeting-scheduler/index.js +16 -41
  101. package/dist/components/meeting-scheduler/index.js.map +1 -1
  102. package/dist/components/meeting-scheduler/slot-picker.d.ts.map +1 -1
  103. package/dist/components/navigation/index.cjs +7 -7
  104. package/dist/components/navigation/index.js +6 -6
  105. package/dist/components/onboarding-guides/index.cjs +7 -7
  106. package/dist/components/onboarding-guides/index.js +6 -6
  107. package/dist/components/related-content/index.cjs +3 -3
  108. package/dist/components/related-content/index.js +2 -2
  109. package/dist/components/shared/article-author-byline.d.ts.map +1 -1
  110. package/dist/components/tickets/index.cjs +8 -8
  111. package/dist/components/tickets/index.js +7 -7
  112. package/dist/components/ui/date-picker.d.ts.map +1 -1
  113. package/dist/components/ui/device-card.d.ts.map +1 -1
  114. package/dist/components/ui/drawer.d.ts +19 -5
  115. package/dist/components/ui/drawer.d.ts.map +1 -1
  116. package/dist/components/ui/index.cjs +4 -10
  117. package/dist/components/ui/index.cjs.map +1 -1
  118. package/dist/components/ui/index.js +3 -9
  119. package/dist/components/ui/table/table-timestamp-cell.d.ts.map +1 -1
  120. package/dist/index.cjs +29 -17
  121. package/dist/index.cjs.map +1 -1
  122. package/dist/index.js +35 -23
  123. package/dist/index.js.map +1 -1
  124. package/dist/utils/date-formatters.d.ts +7 -2
  125. package/dist/utils/date-formatters.d.ts.map +1 -1
  126. package/dist/utils/date-utils.d.ts +4 -1
  127. package/dist/utils/date-utils.d.ts.map +1 -1
  128. package/dist/utils/format-date.d.ts.map +1 -1
  129. package/dist/utils/format.d.ts +155 -11
  130. package/dist/utils/format.d.ts.map +1 -1
  131. package/dist/utils/index.cjs +223 -109
  132. package/dist/utils/index.cjs.map +1 -1
  133. package/dist/utils/index.d.ts +4 -1
  134. package/dist/utils/index.d.ts.map +1 -1
  135. package/dist/utils/index.js +211 -110
  136. package/dist/utils/index.js.map +1 -1
  137. package/dist/utils/program-instant.d.ts +145 -0
  138. package/dist/utils/program-instant.d.ts.map +1 -0
  139. package/dist/utils/program-meta-renderers.d.ts +3 -0
  140. package/dist/utils/program-meta-renderers.d.ts.map +1 -0
  141. package/dist/utils/url-safety.d.ts +33 -0
  142. package/dist/utils/url-safety.d.ts.map +1 -0
  143. package/package.json +1 -1
  144. package/src/chat-protocol/__tests__/source-metadata.test.ts +70 -3
  145. package/src/chat-protocol/source-metadata.ts +22 -6
  146. package/src/components/chat/chat-sidebar.tsx +4 -11
  147. package/src/components/chat/entity-cards/.program-card.md +1 -1
  148. package/src/components/chat/entity-cards/blog-card.tsx +4 -24
  149. package/src/components/chat/entity-cards/dispatch.tsx +9 -27
  150. package/src/components/chat/entity-cards/program-card.tsx +42 -81
  151. package/src/components/chat/types/entities/investor-update.ts +4 -6
  152. package/src/components/chat/types/entities/program-types.ts +8 -89
  153. package/src/components/chat/utils/.compact-card-classes.md +1 -1
  154. package/src/components/chat/utils/compact-card-classes.ts +5 -3
  155. package/src/components/logs-list.tsx +4 -13
  156. package/src/components/meeting-scheduler/confirmation.tsx +6 -10
  157. package/src/components/meeting-scheduler/directory.tsx +2 -12
  158. package/src/components/meeting-scheduler/index.tsx +3 -11
  159. package/src/components/meeting-scheduler/slot-picker.tsx +4 -7
  160. package/src/components/shared/article-author-byline.tsx +4 -13
  161. package/src/components/ui/.drawer.md +1 -0
  162. package/src/components/ui/__tests__/drawer-size.test.tsx +38 -0
  163. package/src/components/ui/date-picker.tsx +6 -13
  164. package/src/components/ui/device-card.tsx +4 -10
  165. package/src/components/ui/drawer.tsx +44 -9
  166. package/src/components/ui/table/table-timestamp-cell.tsx +8 -2
  167. package/src/utils/.format.md +5 -2
  168. package/src/utils/__tests__/date-rendering.test.ts +118 -0
  169. package/src/utils/__tests__/format-program-dates.test.ts +148 -0
  170. package/src/utils/__tests__/program-instant.test.ts +125 -0
  171. package/src/utils/__tests__/url-safety.test.ts +44 -0
  172. package/src/utils/date-formatters.ts +18 -29
  173. package/src/utils/date-utils.ts +27 -40
  174. package/src/utils/format-date.ts +14 -16
  175. package/src/utils/format.ts +367 -66
  176. package/src/utils/index.ts +24 -0
  177. package/src/utils/program-instant.ts +180 -0
  178. package/src/utils/program-meta-renderers.ts +18 -0
  179. package/src/utils/url-safety.ts +43 -0
  180. package/dist/chunk-2NRLRRMR.cjs.map +0 -1
  181. package/dist/chunk-3I6XHQUD.js.map +0 -1
  182. package/dist/chunk-3IPL6G7S.js.map +0 -1
  183. package/dist/chunk-O4LL7RQV.cjs.map +0 -1
  184. package/dist/chunk-ORFJVMAL.js.map +0 -1
  185. package/dist/chunk-OYI3K5R6.cjs.map +0 -1
  186. package/dist/chunk-SDGMLXIP.js.map +0 -1
  187. package/dist/chunk-VHB3I6F3.cjs.map +0 -1
  188. /package/dist/{chunk-YM6L3WM5.js.map → chunk-27RD5XTP.js.map} +0 -0
  189. /package/dist/{chunk-POPL3W2S.js.map → chunk-3DGRXC74.js.map} +0 -0
  190. /package/dist/{chunk-6GY6DFIH.js.map → chunk-4WVWRFGP.js.map} +0 -0
  191. /package/dist/{chunk-6NHLZORM.js.map → chunk-7Q5XXPCB.js.map} +0 -0
  192. /package/dist/{chunk-3LXJEXPH.js.map → chunk-B3Z3RJRW.js.map} +0 -0
  193. /package/dist/{chunk-MJ424FEC.js.map → chunk-HOGOQA2X.js.map} +0 -0
  194. /package/dist/{chunk-HW7BLVQH.js.map → chunk-IXD6SHQ6.js.map} +0 -0
  195. /package/dist/{chunk-S254VEDE.js.map → chunk-MRIOYSXH.js.map} +0 -0
  196. /package/dist/{chunk-XWGHLSAL.js.map → chunk-PFV4DAX5.js.map} +0 -0
  197. /package/dist/{chunk-UFBWNVZZ.js.map → chunk-RNMGKAS6.js.map} +0 -0
  198. /package/dist/{chunk-ZAIYD3MZ.js.map → chunk-S2KMNFFN.js.map} +0 -0
  199. /package/dist/{chunk-ZGPJ3NVF.js.map → chunk-SKABQX44.js.map} +0 -0
  200. /package/dist/{chunk-M7QROULE.js.map → chunk-UEXIMEVU.js.map} +0 -0
  201. /package/dist/{chunk-J4RZVLLQ.js.map → chunk-VE52MSYC.js.map} +0 -0
@@ -1,24 +1,22 @@
1
1
  /**
2
- * Shared Date Formatting Utilities
3
- * Single source of truth for date formatting across the application
2
+ * Calendar-date presets.
3
+ *
4
+ * These format the DAY AS WRITTEN — the `YYYY-MM-DD` head of the input — so a
5
+ * `"2025-11-11"` never renders as Nov 10 west of UTC. The rendering itself is
6
+ * `formatDateWithTimezone` in `./format`: the day head is a UTC midnight
7
+ * rendered UTC-pinned, which is exactly the day written, on any machine. They
8
+ * used to look month names up in their own arrays.
4
9
  */
5
10
 
6
- const MONTHS_LONG = [
7
- 'January',
8
- 'February',
9
- 'March',
10
- 'April',
11
- 'May',
12
- 'June',
13
- 'July',
14
- 'August',
15
- 'September',
16
- 'October',
17
- 'November',
18
- 'December',
19
- ] as const;
11
+ import { type ZonedDateStyle, formatDateWithTimezone } from './format';
20
12
 
21
- const MONTHS_SHORT = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] as const;
13
+ /** Render the calendar day an ISO date/date-time string names, or return the
14
+ * input unchanged if it has no `YYYY-MM-DD` head. */
15
+ function formatDayHead(dateString: string, style: ZonedDateStyle): string {
16
+ const ymd = splitYmd(dateString);
17
+ if (!ymd) return dateString;
18
+ return formatDateWithTimezone(ymd.join('-'), null, style) || dateString;
19
+ }
22
20
 
23
21
  /**
24
22
  * Split an ISO date / date-time string into `[year, month, day]` strings.
@@ -37,10 +35,7 @@ function splitYmd(dateString: string): [string, string, string] | null {
37
35
  * @returns e.g. `"November 11, 2025"`
38
36
  */
39
37
  export function formatReleaseDate(dateString: string): string {
40
- const ymd = splitYmd(dateString);
41
- if (!ymd) return dateString;
42
- const [year, month, day] = ymd;
43
- return `${MONTHS_LONG[parseInt(month) - 1]} ${parseInt(day)}, ${year}`;
38
+ return formatDayHead(dateString, 'long');
44
39
  }
45
40
 
46
41
  /**
@@ -51,10 +46,7 @@ export function formatReleaseDate(dateString: string): string {
51
46
  * lib chat cards (campaign-card-admin).
52
47
  */
53
48
  export function formatDateShort(dateString: string): string {
54
- const ymd = splitYmd(dateString);
55
- if (!ymd) return dateString;
56
- const [year, month, day] = ymd;
57
- return `${MONTHS_SHORT[parseInt(month) - 1]} ${parseInt(day)}, ${year}`;
49
+ return formatDayHead(dateString, 'medium');
58
50
  }
59
51
 
60
52
  /**
@@ -63,8 +55,5 @@ export function formatDateShort(dateString: string): string {
63
55
  * interview cards where the compact MM/DD/YYYY layout is desired.
64
56
  */
65
57
  export function formatDateSlashUTC(dateString: string): string {
66
- const ymd = splitYmd(dateString);
67
- if (!ymd) return dateString;
68
- const [year, month, day] = ymd;
69
- return `${month}/${day}/${year}`;
58
+ return formatDayHead(dateString, 'numeric');
70
59
  }
@@ -1,8 +1,22 @@
1
1
  /**
2
2
  * Unified Date Utilities for OpenMSP Platform
3
- * Provides consistent date formatting across all components
3
+ *
4
+ * Relative-time logic lives here; every ABSOLUTE date or time these helpers
5
+ * print is rendered by `formatDateWithTimezone` in `./format`, with the zone
6
+ * stated explicitly — never by a local `toLocale*` call or hand-built string.
4
7
  */
5
8
 
9
+ import { formatDateWithTimezone } from './format';
10
+
11
+ /** `mediumDateTime`'s fields, spread so a caller's own options still override. */
12
+ const ZONED_DATE_FIELDS_MEDIUM_DATETIME: Intl.DateTimeFormatOptions = {
13
+ year: 'numeric',
14
+ month: 'short',
15
+ day: 'numeric',
16
+ hour: 'numeric',
17
+ minute: '2-digit',
18
+ };
19
+
6
20
  /**
7
21
  * Relative display label for a ticket timestamp (ISO string).
8
22
  * < 1 min → "Just now" | 1-59 min → "X min ago" | 1-23 h → "X hour(s) ago" | 24+ h → "MM/DD/YYYY"
@@ -17,30 +31,17 @@ export function formatTicketRelativeTime(iso: string): string {
17
31
  if (diffMin < 60) return `${diffMin} min ago`;
18
32
  const diffHours = Math.floor(diffMin / 60);
19
33
  if (diffHours < 24) return diffHours === 1 ? '1 hour ago' : `${diffHours} hours ago`;
20
- // UTC getters so the MM/DD/YYYY tail is identical on server (UTC) and client
21
- // (local) — otherwise React #418 hydration mismatch.
22
- const mm = String(date.getUTCMonth() + 1).padStart(2, '0');
23
- const dd = String(date.getUTCDate()).padStart(2, '0');
24
- const yyyy = date.getUTCFullYear();
25
- return `${mm}/${dd}/${yyyy}`;
34
+ // UTC-pinned through the one renderer — see `formatDateWithTimezone`.
35
+ return formatDateWithTimezone(date, null, 'numeric');
26
36
  }
27
37
 
28
38
  /**
29
39
  * Full tooltip timestamp in "MM/DD/YYYY, H:MM AM/PM" format.
30
40
  */
31
41
  export function formatTicketFullTimestamp(iso: string): string {
32
- const date = new Date(iso);
33
- if (Number.isNaN(date.getTime())) return '';
34
- // UTC getters so the tooltip timestamp is identical on server (UTC) and
35
- // client (local) — otherwise React #418 hydration mismatch.
36
- const mm = String(date.getUTCMonth() + 1).padStart(2, '0');
37
- const dd = String(date.getUTCDate()).padStart(2, '0');
38
- const yyyy = date.getUTCFullYear();
39
- let hours = date.getUTCHours();
40
- const minutes = String(date.getUTCMinutes()).padStart(2, '0');
41
- const ampm = hours >= 12 ? 'PM' : 'AM';
42
- hours = hours % 12 || 12;
43
- return `${mm}/${dd}/${yyyy}, ${hours}:${minutes} ${ampm}`;
42
+ // UTC-pinned through the one renderer — see `formatDateWithTimezone`. This was
43
+ // a hand-assembled `MM/DD/YYYY, H:MM AM` built from `getUTC*` getters.
44
+ return formatDateWithTimezone(iso, null, 'numericDateTime');
44
45
  }
45
46
 
46
47
  /**
@@ -95,11 +96,10 @@ export function formatRelativeTime(timestamp: string | Date): string {
95
96
  // Older than 30 days - show formatted date, pinned to UTC so SSR (UTC) and
96
97
  // the client agree (React #418). Year comparison also uses UTC for the same
97
98
  // reason (avoids a server/client split right at a year boundary).
98
- return targetTime.toLocaleDateString('en-US', {
99
+ return formatDateWithTimezone(targetTime, null, {
99
100
  month: 'short',
100
101
  day: 'numeric',
101
102
  year: targetTime.getUTCFullYear() !== now.getUTCFullYear() ? 'numeric' : undefined,
102
- timeZone: 'UTC',
103
103
  });
104
104
  }
105
105
 
@@ -118,17 +118,13 @@ export function formatAbsoluteDate(timestamp: string | Date, options: Intl.DateT
118
118
  return 'Invalid date';
119
119
  }
120
120
 
121
- const defaultOptions: Intl.DateTimeFormatOptions = {
121
+ // UTC unless the caller names a zone; `options.timeZone` is passed as THE zone.
122
+ return formatDateWithTimezone(targetTime, options.timeZone ?? null, {
122
123
  year: 'numeric',
123
124
  month: 'short',
124
125
  day: 'numeric',
125
- // Pin to UTC so SSR (Vercel = UTC) and the client agree (React #418).
126
- // Caller can override via `options`.
127
- timeZone: 'UTC',
128
126
  ...options,
129
- };
130
-
131
- return targetTime.toLocaleDateString('en-US', defaultOptions);
127
+ });
132
128
  }
133
129
 
134
130
  /**
@@ -146,19 +142,10 @@ export function formatDateTime(timestamp: string | Date, options: Intl.DateTimeF
146
142
  return 'Invalid date';
147
143
  }
148
144
 
149
- const defaultOptions: Intl.DateTimeFormatOptions = {
150
- year: 'numeric',
151
- month: 'short',
152
- day: 'numeric',
153
- hour: 'numeric',
154
- minute: '2-digit',
155
- // Pin to UTC so SSR (Vercel = UTC) and the client agree (React #418).
156
- // Caller can override via `options`.
157
- timeZone: 'UTC',
145
+ return formatDateWithTimezone(targetTime, options.timeZone ?? null, {
146
+ ...ZONED_DATE_FIELDS_MEDIUM_DATETIME,
158
147
  ...options,
159
- };
160
-
161
- return targetTime.toLocaleDateString('en-US', defaultOptions);
148
+ });
162
149
  }
163
150
 
164
151
  /**
@@ -1,24 +1,22 @@
1
1
  // Locale-aware date/time formatters — mirrors openframe-frontend
2
- // `src/lib/format-date.ts`. Formats follow the user's locale
3
- // (e.g. MM/DD/YYYY in en-US vs DD.MM.YYYY in european locales).
2
+ // `src/lib/format-date.ts`. Formats follow the user's LOCALE and ZONE
3
+ // (e.g. MM/DD/YYYY in en-US vs DD.MM.YYYY in european locales): these back the
4
+ // dashboard's client-rendered tables, where "your local time" is the meaning.
5
+ //
6
+ // Rendered by `formatDateWithTimezone` in `./format` with the viewer zone and
7
+ // locale stated explicitly — not by a second set of `Intl` instances here.
4
8
 
5
- type DateInput = string | number | Date;
9
+ import { formatDateWithTimezone, VIEWER_TIMEZONE } from './format';
6
10
 
7
- const toDate = (input: DateInput): Date => (input instanceof Date ? input : new Date(input));
11
+ type DateInput = string | number | Date;
8
12
 
9
- // Shown when the input is missing or unparseable. `Intl.DateTimeFormat.format`
10
- // throws `RangeError: Invalid time value` on an invalid Date, so every formatter
11
- // here guards first — callers can pass raw API values without a per-call check.
13
+ // Shown when the input is missing or unparseable, so callers can pass raw API
14
+ // values without a per-call check.
12
15
  const INVALID_DATE_PLACEHOLDER = '—';
13
16
 
14
- const dateFmt = new Intl.DateTimeFormat(undefined, { dateStyle: 'short' });
15
- const timeFmt = new Intl.DateTimeFormat(undefined, { timeStyle: 'short' });
16
-
17
- const format = (input: DateInput, fmt: Intl.DateTimeFormat): string => {
18
- const date = toDate(input);
19
- return Number.isNaN(date.getTime()) ? INVALID_DATE_PLACEHOLDER : fmt.format(date);
20
- };
17
+ const render = (input: DateInput, fields: Intl.DateTimeFormatOptions): string =>
18
+ formatDateWithTimezone(input, VIEWER_TIMEZONE, fields, { viewerLocale: true }) || INVALID_DATE_PLACEHOLDER;
21
19
 
22
- export const formatDate = (input: DateInput): string => format(input, dateFmt);
20
+ export const formatDate = (input: DateInput): string => render(input, { dateStyle: 'short' });
23
21
 
24
- export const formatTime = (input: DateInput): string => format(input, timeFmt);
22
+ export const formatTime = (input: DateInput): string => render(input, { timeStyle: 'short' });