@flamingo-stack/openframe-frontend-core 0.0.643 → 0.0.644-2208.6319.1
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.
- package/dist/chat-protocol/index.cjs +20 -3
- package/dist/chat-protocol/index.cjs.map +1 -1
- package/dist/chat-protocol/index.js +20 -3
- package/dist/chat-protocol/index.js.map +1 -1
- package/dist/chat-protocol/source-metadata.d.ts +7 -1
- package/dist/chat-protocol/source-metadata.d.ts.map +1 -1
- package/dist/{chunk-B42INNRA.cjs → chunk-2UA3DT5O.cjs} +199 -199
- package/dist/{chunk-B42INNRA.cjs.map → chunk-2UA3DT5O.cjs.map} +1 -1
- package/dist/{chunk-KX2FT7AS.cjs → chunk-2ZGEXLQW.cjs} +28 -28
- package/dist/{chunk-KX2FT7AS.cjs.map → chunk-2ZGEXLQW.cjs.map} +1 -1
- package/dist/{chunk-2NRLRRMR.cjs → chunk-3HSRNCDV.cjs} +226 -203
- package/dist/chunk-3HSRNCDV.cjs.map +1 -0
- package/dist/{chunk-64KDKDYC.js → chunk-5ELZ2NQ5.js} +6 -6
- package/dist/{chunk-2DJH6KHA.cjs → chunk-B46Q4DTN.cjs} +382 -386
- package/dist/chunk-B46Q4DTN.cjs.map +1 -0
- package/dist/{chunk-N7UYD57Q.js → chunk-C7RU466R.js} +3 -3
- package/dist/{chunk-2NODQ7FO.js → chunk-DSJZYRS6.js} +17 -21
- package/dist/{chunk-2NODQ7FO.js.map → chunk-DSJZYRS6.js.map} +1 -1
- package/dist/{chunk-26D6FM6L.cjs → chunk-EKSCVXA3.cjs} +6 -6
- package/dist/{chunk-26D6FM6L.cjs.map → chunk-EKSCVXA3.cjs.map} +1 -1
- package/dist/{chunk-7HL2PNQ3.js → chunk-GEGE3JXC.js} +5 -5
- package/dist/{chunk-7T673MHJ.cjs → chunk-GUB6BR26.cjs} +22 -22
- package/dist/{chunk-7T673MHJ.cjs.map → chunk-GUB6BR26.cjs.map} +1 -1
- package/dist/{chunk-3IPL6G7S.js → chunk-GXNQPCL4.js} +164 -141
- package/dist/chunk-GXNQPCL4.js.map +1 -0
- package/dist/{chunk-D6TWJEFW.cjs → chunk-GZXW5QWQ.cjs} +15 -15
- package/dist/{chunk-D6TWJEFW.cjs.map → chunk-GZXW5QWQ.cjs.map} +1 -1
- package/dist/{chunk-4TE53O6U.js → chunk-HAQRGJFL.js} +4 -4
- package/dist/{chunk-TIOHTWDA.js → chunk-INISTVWK.js} +6 -6
- package/dist/{chunk-IU3IYXMM.js → chunk-IRV2W7GN.js} +7 -7
- package/dist/{chunk-R2IU2Y2O.cjs → chunk-JWCAWGLG.cjs} +33 -33
- package/dist/{chunk-R2IU2Y2O.cjs.map → chunk-JWCAWGLG.cjs.map} +1 -1
- package/dist/{chunk-77EO26XV.cjs → chunk-LNLNPCII.cjs} +5 -5
- package/dist/{chunk-77EO26XV.cjs.map → chunk-LNLNPCII.cjs.map} +1 -1
- package/dist/{chunk-42NXGOTG.cjs → chunk-N3M56EE5.cjs} +3 -3
- package/dist/{chunk-42NXGOTG.cjs.map → chunk-N3M56EE5.cjs.map} +1 -1
- package/dist/{chunk-O7JMF5OT.js → chunk-O47SGDBV.js} +3 -3
- package/dist/{chunk-EWQI5MV6.cjs → chunk-OANRA5ML.cjs} +20 -20
- package/dist/{chunk-EWQI5MV6.cjs.map → chunk-OANRA5ML.cjs.map} +1 -1
- package/dist/{chunk-NCHLLTAR.js → chunk-PR6IR22M.js} +3 -3
- package/dist/{chunk-6MQBLFUM.js → chunk-Q7JDIDE2.js} +5 -5
- package/dist/{chunk-YG7KLZE7.js → chunk-R5EIFOW2.js} +4 -4
- package/dist/{chunk-5E6Y6766.cjs → chunk-S2E4I3WP.cjs} +29 -29
- package/dist/{chunk-5E6Y6766.cjs.map → chunk-S2E4I3WP.cjs.map} +1 -1
- package/dist/{chunk-SE6YRE3R.cjs → chunk-SAD5IUSO.cjs} +32 -32
- package/dist/{chunk-SE6YRE3R.cjs.map → chunk-SAD5IUSO.cjs.map} +1 -1
- package/dist/{chunk-3LXJEXPH.js → chunk-TAP4MJPF.js} +2 -2
- package/dist/{chunk-M3W5Y5DK.cjs → chunk-TEKH3J65.cjs} +11 -11
- package/dist/{chunk-M3W5Y5DK.cjs.map → chunk-TEKH3J65.cjs.map} +1 -1
- package/dist/{chunk-HA2U7WHU.js → chunk-TXNWDP3M.js} +3 -3
- package/dist/{chunk-IIZX3K2R.js → chunk-URGDDCJL.js} +2 -2
- package/dist/{chunk-TQ7KTANJ.js → chunk-V52INSJH.js} +3 -3
- package/dist/{chunk-FO7SD2IQ.cjs → chunk-VA6N7IVZ.cjs} +6 -6
- package/dist/{chunk-FO7SD2IQ.cjs.map → chunk-VA6N7IVZ.cjs.map} +1 -1
- package/dist/{chunk-CWHLVXUW.cjs → chunk-WYS66RIO.cjs} +10 -10
- package/dist/{chunk-CWHLVXUW.cjs.map → chunk-WYS66RIO.cjs.map} +1 -1
- package/dist/{chunk-XJLWGYL4.cjs → chunk-XVGWYNRY.cjs} +81 -81
- package/dist/{chunk-XJLWGYL4.cjs.map → chunk-XVGWYNRY.cjs.map} +1 -1
- package/dist/{chunk-ZU2JBBOE.cjs → chunk-XYJ3URIN.cjs} +59 -59
- package/dist/{chunk-ZU2JBBOE.cjs.map → chunk-XYJ3URIN.cjs.map} +1 -1
- package/dist/{chunk-FVIT23I5.js → chunk-Z5KAIEZ4.js} +3 -3
- package/dist/{chunk-YT6RGA3X.js → chunk-ZPLT4XLC.js} +3 -3
- package/dist/components/case-studies/index.cjs +16 -16
- package/dist/components/case-studies/index.js +4 -4
- package/dist/components/chat/entity-cards/dispatch.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/program-card.d.ts.map +1 -1
- package/dist/components/chat/index.cjs +3 -9
- package/dist/components/chat/index.cjs.map +1 -1
- package/dist/components/chat/index.js +2 -8
- package/dist/components/chat/types/entities/program-types.d.ts +29 -18
- package/dist/components/chat/types/entities/program-types.d.ts.map +1 -1
- package/dist/components/chat/utils/compact-card-classes.d.ts.map +1 -1
- package/dist/components/contact/index.cjs +5 -5
- package/dist/components/contact/index.js +4 -4
- package/dist/components/docs/index.cjs +8 -8
- package/dist/components/docs/index.js +7 -7
- package/dist/components/embeds/index.cjs +5 -5
- package/dist/components/embeds/index.js +4 -4
- package/dist/components/faq/index.cjs +5 -5
- package/dist/components/faq/index.js +4 -4
- package/dist/components/features/index.cjs +4 -4
- package/dist/components/features/index.js +3 -3
- package/dist/components/help-center-pages/index.cjs +24 -24
- package/dist/components/help-center-pages/index.js +15 -15
- package/dist/components/index.cjs +53 -59
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.js +15 -21
- package/dist/components/index.js.map +1 -1
- package/dist/components/meeting-scheduler/index.cjs +34 -34
- package/dist/components/meeting-scheduler/index.js +3 -3
- package/dist/components/navigation/index.cjs +7 -7
- package/dist/components/navigation/index.js +6 -6
- package/dist/components/onboarding-guides/index.cjs +7 -7
- package/dist/components/onboarding-guides/index.js +6 -6
- package/dist/components/related-content/index.cjs +3 -3
- package/dist/components/related-content/index.js +2 -2
- package/dist/components/tickets/index.cjs +8 -8
- package/dist/components/tickets/index.js +7 -7
- package/dist/components/ui/index.cjs +4 -10
- package/dist/components/ui/index.cjs.map +1 -1
- package/dist/components/ui/index.js +3 -9
- package/dist/index.cjs +24 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +30 -14
- package/dist/index.js.map +1 -1
- package/dist/utils/format.d.ts +127 -4
- package/dist/utils/format.d.ts.map +1 -1
- package/dist/utils/index.cjs +113 -5
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.ts +4 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +103 -6
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/program-instant.d.ts +171 -0
- package/dist/utils/program-instant.d.ts.map +1 -0
- package/dist/utils/program-meta-renderers.d.ts +3 -0
- package/dist/utils/program-meta-renderers.d.ts.map +1 -0
- package/dist/utils/url-safety.d.ts +35 -0
- package/dist/utils/url-safety.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/chat-protocol/__tests__/source-metadata.test.ts +76 -0
- package/src/chat-protocol/source-metadata.ts +40 -6
- package/src/components/chat/entity-cards/.program-card.md +1 -1
- package/src/components/chat/entity-cards/dispatch.tsx +9 -27
- package/src/components/chat/entity-cards/program-card.tsx +42 -81
- package/src/components/chat/types/entities/program-types.ts +29 -89
- package/src/components/chat/utils/.compact-card-classes.md +1 -1
- package/src/components/chat/utils/compact-card-classes.ts +5 -3
- package/src/utils/.format.md +5 -2
- package/src/utils/__tests__/format-program-dates.test.ts +180 -0
- package/src/utils/__tests__/program-instant.test.ts +170 -0
- package/src/utils/__tests__/url-safety.test.ts +44 -0
- package/src/utils/format.ts +228 -13
- package/src/utils/index.ts +22 -0
- package/src/utils/program-instant.ts +211 -0
- package/src/utils/program-meta-renderers.ts +18 -0
- package/src/utils/url-safety.ts +45 -0
- package/dist/chunk-2DJH6KHA.cjs.map +0 -1
- package/dist/chunk-2NRLRRMR.cjs.map +0 -1
- package/dist/chunk-3IPL6G7S.js.map +0 -1
- /package/dist/{chunk-64KDKDYC.js.map → chunk-5ELZ2NQ5.js.map} +0 -0
- /package/dist/{chunk-N7UYD57Q.js.map → chunk-C7RU466R.js.map} +0 -0
- /package/dist/{chunk-7HL2PNQ3.js.map → chunk-GEGE3JXC.js.map} +0 -0
- /package/dist/{chunk-4TE53O6U.js.map → chunk-HAQRGJFL.js.map} +0 -0
- /package/dist/{chunk-TIOHTWDA.js.map → chunk-INISTVWK.js.map} +0 -0
- /package/dist/{chunk-IU3IYXMM.js.map → chunk-IRV2W7GN.js.map} +0 -0
- /package/dist/{chunk-O7JMF5OT.js.map → chunk-O47SGDBV.js.map} +0 -0
- /package/dist/{chunk-NCHLLTAR.js.map → chunk-PR6IR22M.js.map} +0 -0
- /package/dist/{chunk-6MQBLFUM.js.map → chunk-Q7JDIDE2.js.map} +0 -0
- /package/dist/{chunk-YG7KLZE7.js.map → chunk-R5EIFOW2.js.map} +0 -0
- /package/dist/{chunk-3LXJEXPH.js.map → chunk-TAP4MJPF.js.map} +0 -0
- /package/dist/{chunk-HA2U7WHU.js.map → chunk-TXNWDP3M.js.map} +0 -0
- /package/dist/{chunk-IIZX3K2R.js.map → chunk-URGDDCJL.js.map} +0 -0
- /package/dist/{chunk-TQ7KTANJ.js.map → chunk-V52INSJH.js.map} +0 -0
- /package/dist/{chunk-FVIT23I5.js.map → chunk-Z5KAIEZ4.js.map} +0 -0
- /package/dist/{chunk-YT6RGA3X.js.map → chunk-ZPLT4XLC.js.map} +0 -0
|
@@ -19,14 +19,15 @@
|
|
|
19
19
|
* and pass the resolved detail URL via `href`.
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
import { format } from 'date-fns';
|
|
23
22
|
import { ExternalLink, Clock, Play, Video } from 'lucide-react';
|
|
24
23
|
import type React from 'react';
|
|
25
24
|
import { useState } from 'react';
|
|
26
25
|
import Image from '../../../embed-shims/next-image';
|
|
27
26
|
import { cn } from '../../../utils/cn';
|
|
28
|
-
import {
|
|
27
|
+
import { formatProgramDate } from '../../../utils/format';
|
|
29
28
|
import { isImageMedia } from '../../../utils/media-type';
|
|
29
|
+
import { programMetaFormatters, programMetaLine } from '../../../utils/program-instant';
|
|
30
|
+
import { PROGRAM_META_RENDERERS } from '../../../utils/program-meta-renderers';
|
|
30
31
|
import { Button } from '../../ui/button/button';
|
|
31
32
|
import { ImageGalleryModal } from '../../ui/image-gallery-modal';
|
|
32
33
|
import { SquareAvatar } from '../../ui/square-avatar';
|
|
@@ -52,26 +53,8 @@ import {
|
|
|
52
53
|
import { EntityPortraitCard } from './entity-portrait-card';
|
|
53
54
|
import { useEntityCardLink } from './use-entity-card-link';
|
|
54
55
|
import { useEntityCardPlaceholder } from './use-entity-card-placeholder';
|
|
55
|
-
type CardSize = 'default' | 'sm' | 'portrait';
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
* Format a Date with date-fns pinned to UTC. `date-fns` `format()` reads the
|
|
59
|
-
* runtime's LOCAL wall-clock, so the same instant renders differently on the
|
|
60
|
-
* server (Vercel = UTC) and the client (visitor tz) → React #418 hydration
|
|
61
|
-
* mismatch. Shifting by the local offset before formatting emits the UTC
|
|
62
|
-
* wall-clock on every machine, so server and client agree. Mirrors the helper
|
|
63
|
-
* in the hub's `program-header.tsx` (kept local — the lib has no date-fns-tz
|
|
64
|
-
* dep) and the repo-wide "pin program dates to UTC" convention.
|
|
65
|
-
*/
|
|
66
|
-
function formatUtc(date: Date, fmt: string): string {
|
|
67
|
-
// A row can legitimately arrive without a date (the field is not guaranteed by
|
|
68
|
-
// the wire type), and `new Date(undefined)` / `new Date('')` both give an
|
|
69
|
-
// Invalid Date, which makes date-fns `format()` throw RangeError. Thrown from
|
|
70
|
-
// render that takes down the whole card rail, not just this card — so the
|
|
71
|
-
// helper is total and an unknown date renders as nothing.
|
|
72
|
-
if (Number.isNaN(date.getTime())) return '';
|
|
73
|
-
return format(new Date(date.getTime() + date.getTimezoneOffset() * 60_000), fmt);
|
|
74
|
-
}
|
|
57
|
+
type CardSize = 'default' | 'sm' | 'portrait';
|
|
75
58
|
|
|
76
59
|
export function ProgramCardSkeleton({ size = 'default' }: { size?: CardSize }) {
|
|
77
60
|
if (size === 'sm') {
|
|
@@ -176,24 +159,6 @@ function getHosts(hosts: ProgramHost[] | null | undefined): Array<{ name: string
|
|
|
176
159
|
return [];
|
|
177
160
|
}
|
|
178
161
|
|
|
179
|
-
/**
|
|
180
|
-
* Webinar scheduling columns, read off a `BaseProgramItem` that has already
|
|
181
|
-
* been `in`-guarded for `start_at`. Each field is validated rather than
|
|
182
|
-
* asserted — the generic item type does not declare them.
|
|
183
|
-
*/
|
|
184
|
-
function webinarTiming(item: BaseProgramItem): {
|
|
185
|
-
startAt: string | null;
|
|
186
|
-
endAt: string | null;
|
|
187
|
-
timezone: string | null;
|
|
188
|
-
} {
|
|
189
|
-
const str = (value: unknown): string | null => (typeof value === 'string' && value ? value : null);
|
|
190
|
-
return {
|
|
191
|
-
startAt: 'start_at' in item ? str(item.start_at) : null,
|
|
192
|
-
endAt: 'end_at' in item ? str(item.end_at) : null,
|
|
193
|
-
timezone: 'timezone' in item ? str(item.timezone) : null,
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
|
|
197
162
|
function MediaGallery({ images, title }: { images: ProgramMedia[]; title: string }) {
|
|
198
163
|
const [selectedImageIndex, setSelectedImageIndex] = useState<number | null>(null);
|
|
199
164
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
@@ -282,24 +247,16 @@ export function ProgramCard<T extends BaseProgramItem>({
|
|
|
282
247
|
// below is followed by a real type check instead of a cast.
|
|
283
248
|
const isScheduled = 'status' in item && item.status === 'scheduled';
|
|
284
249
|
|
|
285
|
-
//
|
|
286
|
-
//
|
|
287
|
-
const
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
const { startAt, endAt, timezone } = webinarTiming(item);
|
|
296
|
-
const time = formatTimeWithTimezone(startAt, timezone);
|
|
297
|
-
const dur = formatDurationFromRange(startAt, endAt);
|
|
298
|
-
return dur ? `${time} · ${dur}` : time;
|
|
299
|
-
}
|
|
300
|
-
return null;
|
|
301
|
-
};
|
|
302
|
-
const compactDate = formatUtc(new Date(item.date), 'MMM d, yyyy');
|
|
250
|
+
// The compact meta line, built by the ONE shared function — the chat card
|
|
251
|
+
// renders the same string from the same code rather than mirroring it.
|
|
252
|
+
const {
|
|
253
|
+
at: zonedDate,
|
|
254
|
+
typeMeta: compactTypeMetaValue,
|
|
255
|
+
line: compactMetaLine,
|
|
256
|
+
// Compact densities join plain strings, so the zone rides inline here; the
|
|
257
|
+
// default density below renders it as its own styled span instead.
|
|
258
|
+
} = programMetaLine(item, config.type, programMetaFormatters(PROGRAM_META_RENDERERS));
|
|
259
|
+
const compactDate = formatProgramDate(zonedDate, 'medium');
|
|
303
260
|
|
|
304
261
|
if (size === 'portrait') {
|
|
305
262
|
// Rail/strip density — mapped onto the shared <EntityPortraitCard> shell
|
|
@@ -308,7 +265,7 @@ export function ProgramCard<T extends BaseProgramItem>({
|
|
|
308
265
|
// host); the date · duration meta line fills the subtitle when the
|
|
309
266
|
// profile has no job title.
|
|
310
267
|
const profile = programItemToStripProfile(item);
|
|
311
|
-
const dateMeta =
|
|
268
|
+
const dateMeta = compactMetaLine;
|
|
312
269
|
return (
|
|
313
270
|
<EntityPortraitCard
|
|
314
271
|
href={href}
|
|
@@ -333,7 +290,7 @@ export function ProgramCard<T extends BaseProgramItem>({
|
|
|
333
290
|
if (size === 'sm') {
|
|
334
291
|
const itemDate = compactDate;
|
|
335
292
|
const compactCover = coverImage || placeholderUrl || null;
|
|
336
|
-
const typeMeta =
|
|
293
|
+
const typeMeta = compactTypeMetaValue;
|
|
337
294
|
const subtitleParts = [itemDate, typeMeta, config.labels?.singular].filter(
|
|
338
295
|
(s): s is string => typeof s === 'string' && s.length > 0,
|
|
339
296
|
);
|
|
@@ -377,38 +334,42 @@ export function ProgramCard<T extends BaseProgramItem>({
|
|
|
377
334
|
);
|
|
378
335
|
}
|
|
379
336
|
|
|
380
|
-
const
|
|
381
|
-
|
|
337
|
+
const dateFormat = formatProgramDate(zonedDate, 'weekday');
|
|
338
|
+
|
|
339
|
+
// The same dispatch as the compact densities — WHICH value a type shows is
|
|
340
|
+
// decided once, by `programMetaLine`. Only the presentation differs here
|
|
341
|
+
// (an icon, and the zone as its own styled span rather than inline), which is
|
|
342
|
+
// why this asks for an unlabelled webinar value. Restating the dispatch is
|
|
343
|
+
// how the two ended up with three conditions that disagreed: the podcast one
|
|
344
|
+
// dropped the `> 0` check, and the event one dropped the non-empty check.
|
|
345
|
+
const { typeMeta: defaultTypeMeta } = programMetaLine(
|
|
346
|
+
item,
|
|
347
|
+
config.type,
|
|
348
|
+
programMetaFormatters(PROGRAM_META_RENDERERS, { withZoneLabel: false }),
|
|
349
|
+
);
|
|
382
350
|
|
|
383
351
|
const defaultRenderMeta = () => {
|
|
384
|
-
if (config.type === 'podcast'
|
|
385
|
-
|
|
386
|
-
return (
|
|
352
|
+
if (config.type === 'podcast') {
|
|
353
|
+
return defaultTypeMeta ? (
|
|
387
354
|
<>
|
|
388
355
|
<Clock className="h-4 w-4 text-ods-text-secondary" />
|
|
389
|
-
<span className="font-body text-ods-text-secondary">
|
|
390
|
-
{formatDurationCompact(typeof dur === 'number' ? dur : null)}
|
|
391
|
-
</span>
|
|
356
|
+
<span className="font-body text-ods-text-secondary">{defaultTypeMeta}</span>
|
|
392
357
|
</>
|
|
393
|
-
);
|
|
358
|
+
) : null;
|
|
394
359
|
}
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
360
|
+
// No 'Location TBD' fallback: the page header hides the tile entirely for
|
|
361
|
+
// an event with no location, and two surfaces answering "where is this?"
|
|
362
|
+
// differently — one silent, one confidently "TBD" — is the drift this
|
|
363
|
+
// shared dispatch exists to end.
|
|
364
|
+
if (config.type === 'event') {
|
|
365
|
+
return defaultTypeMeta ? <span className="font-body text-ods-text-secondary">{defaultTypeMeta}</span> : null;
|
|
400
366
|
}
|
|
401
|
-
if (config.type === 'webinar' &&
|
|
402
|
-
const { startAt, endAt, timezone } = webinarTiming(item);
|
|
403
|
-
const duration = formatDurationFromRange(startAt, endAt);
|
|
367
|
+
if (config.type === 'webinar' && (defaultTypeMeta || zonedDate.timezone)) {
|
|
404
368
|
return (
|
|
405
369
|
<>
|
|
406
370
|
<Video className="h-4 w-4 text-ods-text-secondary" />
|
|
407
|
-
<span className="font-body text-ods-text-secondary">
|
|
408
|
-
|
|
409
|
-
{duration && ` · ${duration}`}
|
|
410
|
-
</span>
|
|
411
|
-
{timezone && <span className="text-ods-text-secondary text-h6">({timezone})</span>}
|
|
371
|
+
{defaultTypeMeta && <span className="font-body text-ods-text-secondary">{defaultTypeMeta}</span>}
|
|
372
|
+
{zonedDate.timezone && <span className="text-ods-text-secondary text-h6">({zonedDate.timezone})</span>}
|
|
412
373
|
</>
|
|
413
374
|
);
|
|
414
375
|
}
|
|
@@ -10,10 +10,16 @@
|
|
|
10
10
|
* 3. Configuration-Driven: Program types defined via configuration objects
|
|
11
11
|
* 4. Admin Consistency: Same patterns work for public pages and admin CRUD
|
|
12
12
|
*
|
|
13
|
-
* Lifted from `lib/types/program-types.ts` in the hub.
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
13
|
+
* Lifted from `lib/types/program-types.ts` in the hub.
|
|
14
|
+
*
|
|
15
|
+
* The pure row→item transform helpers that used to live here are GONE. They
|
|
16
|
+
* had no caller in this package or in the host app, and the webinar one
|
|
17
|
+
* hand-rolled `display_date_override ?? start_at` — the expression
|
|
18
|
+
* `programDateInstant` exists to own — without setting the
|
|
19
|
+
* `date_is_display_override` flag it needs, so an overridden webinar built
|
|
20
|
+
* through it rendered with the clock and zone label the rule suppresses
|
|
21
|
+
* everywhere else. A dead PUBLIC export that contradicts the rule is worse
|
|
22
|
+
* than no export. The host app keeps its own transforms, which resolve.
|
|
17
23
|
*/
|
|
18
24
|
|
|
19
25
|
import type { ReactNode } from 'react';
|
|
@@ -166,6 +172,25 @@ export interface BaseProgramItem {
|
|
|
166
172
|
description: string | null;
|
|
167
173
|
cover_url: string | null; // Primary image
|
|
168
174
|
date: string; // ISO date string - maps to: start_at, published_at
|
|
175
|
+
/**
|
|
176
|
+
* True when an admin DISPLAY OVERRIDE supplied `date`, rather than the row's
|
|
177
|
+
* own schedule — the flag `programDateInstant` reads to decide that this
|
|
178
|
+
* value is a chosen DAY, rendered UTC-pinned with no clock and no zone.
|
|
179
|
+
*
|
|
180
|
+
* Declared HERE, on the type `ProgramCard` actually consumes, because while
|
|
181
|
+
* it lived only in the host app's copy of this interface every consumer had
|
|
182
|
+
* to cast past the type to read it — so the compiler could not tell anyone
|
|
183
|
+
* when a producer forgot to set it.
|
|
184
|
+
*
|
|
185
|
+
* NOT the same as "is it a calendar date": the override column is
|
|
186
|
+
* `timestamptz` and the host normalizes through `toISOString()`, so an
|
|
187
|
+
* override always arrives as a full instant. An earlier attempt keyed off
|
|
188
|
+
* value precision and could therefore never fire.
|
|
189
|
+
*/
|
|
190
|
+
date_is_display_override?: boolean;
|
|
191
|
+
/** The event's IANA zone, when the row declares one. Read through
|
|
192
|
+
* `programDateInstant`, never directly — see that module on why. */
|
|
193
|
+
timezone?: string | null;
|
|
169
194
|
external_url?: string | null; // Registration/play link
|
|
170
195
|
hosts?: ProgramHost[] | null; // Speakers/hosts
|
|
171
196
|
// Platform tagging lives in the host app's `entity_platforms` array (exposed
|
|
@@ -377,88 +402,3 @@ export interface AdminProgramFilter extends ProgramFilter {
|
|
|
377
402
|
// ============================================================================
|
|
378
403
|
// TRANSFORM UTILITIES
|
|
379
404
|
// ============================================================================
|
|
380
|
-
|
|
381
|
-
/**
|
|
382
|
-
* Transform a database event row to EventItem
|
|
383
|
-
*/
|
|
384
|
-
export function transformEventToProgram(event: LumaEventRow): EventItem {
|
|
385
|
-
return {
|
|
386
|
-
id: event.id,
|
|
387
|
-
title: event.name,
|
|
388
|
-
description: event.description ?? null,
|
|
389
|
-
cover_url: event.cover_url ?? null,
|
|
390
|
-
date: event.start_at,
|
|
391
|
-
external_url: event.event_url ?? null,
|
|
392
|
-
hosts: event.hosts ?? null,
|
|
393
|
-
luma_api_id: event.luma_api_id,
|
|
394
|
-
end_at: event.end_at,
|
|
395
|
-
timezone: event.timezone ?? null,
|
|
396
|
-
location_name: event.location_name ?? null,
|
|
397
|
-
location_full_address: event.location_full_address ?? null,
|
|
398
|
-
geo_latitude: event.geo_latitude ?? null,
|
|
399
|
-
geo_longitude: event.geo_longitude ?? null,
|
|
400
|
-
meeting_url: event.meeting_url ?? null,
|
|
401
|
-
event_url: event.event_url ?? null,
|
|
402
|
-
guest_count: event.guest_count ?? null,
|
|
403
|
-
visibility: event.visibility ?? null,
|
|
404
|
-
is_deleted: event.is_deleted ?? false,
|
|
405
|
-
};
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
/**
|
|
409
|
-
* Transform a database podcast row to PodcastItem
|
|
410
|
-
*/
|
|
411
|
-
export function transformPodcastToProgram(episode: PodcastEpisodeRow): PodcastItem {
|
|
412
|
-
return {
|
|
413
|
-
id: episode.id,
|
|
414
|
-
title: episode.title,
|
|
415
|
-
description: episode.description ?? null,
|
|
416
|
-
// Use cover_image_override if set, otherwise use cover_url
|
|
417
|
-
cover_url: episode.cover_image_override ?? episode.cover_url ?? null,
|
|
418
|
-
date: episode.published_at ?? episode.created_at,
|
|
419
|
-
external_url: episode.external_url ?? null,
|
|
420
|
-
hosts: episode.hosts ?? null,
|
|
421
|
-
podbean_episode_id: episode.podbean_episode_id,
|
|
422
|
-
podbean_podcast_id: episode.podbean_podcast_id,
|
|
423
|
-
audio_url: episode.audio_url ?? null,
|
|
424
|
-
main_video_url: episode.main_video_url ?? null,
|
|
425
|
-
media_type: episode.media_type ?? 'audio',
|
|
426
|
-
duration_seconds: episode.duration_seconds ?? null,
|
|
427
|
-
status: episode.status ?? 'published',
|
|
428
|
-
published_at: episode.published_at ?? null,
|
|
429
|
-
is_deleted: episode.is_deleted ?? false,
|
|
430
|
-
// Override fields
|
|
431
|
-
cover_image_override: episode.cover_image_override ?? null,
|
|
432
|
-
custom_video_url: episode.custom_video_url ?? null,
|
|
433
|
-
};
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
/**
|
|
437
|
-
* Transform a database webinar row to WebinarItem
|
|
438
|
-
* Uses display_date_override for date field when available (for backdating)
|
|
439
|
-
* Uses cover_image_override for cover_url when available
|
|
440
|
-
*/
|
|
441
|
-
export function transformWebinarToProgram(webinar: WebinarRow): WebinarItem {
|
|
442
|
-
return {
|
|
443
|
-
id: webinar.id,
|
|
444
|
-
title: webinar.title,
|
|
445
|
-
description: webinar.description ?? null,
|
|
446
|
-
// Use cover_image_override if set, otherwise use cover_url
|
|
447
|
-
cover_url: webinar.cover_image_override ?? webinar.cover_url ?? null,
|
|
448
|
-
// Use display_date_override if set, otherwise use start_at
|
|
449
|
-
date: webinar.display_date_override ?? webinar.start_at,
|
|
450
|
-
external_url: webinar.registration_url ?? null,
|
|
451
|
-
hosts: webinar.hosts ?? null,
|
|
452
|
-
livestorm_event_id: webinar.livestorm_event_id,
|
|
453
|
-
start_at: webinar.start_at,
|
|
454
|
-
end_at: webinar.end_at ?? null,
|
|
455
|
-
timezone: webinar.timezone ?? null,
|
|
456
|
-
registration_url: webinar.registration_url ?? null,
|
|
457
|
-
is_deleted: webinar.is_deleted ?? false,
|
|
458
|
-
main_video_url: webinar.main_video_url ?? null,
|
|
459
|
-
// Override fields
|
|
460
|
-
custom_video_url: webinar.custom_video_url ?? null,
|
|
461
|
-
display_date_override: webinar.display_date_override ?? null,
|
|
462
|
-
cover_image_override: webinar.cover_image_override ?? null,
|
|
463
|
-
};
|
|
464
|
-
}
|
|
@@ -28,7 +28,7 @@ Single source of truth for compact card Tailwind class constants and URL safety
|
|
|
28
28
|
|
|
29
29
|
Allowed:
|
|
30
30
|
- `http:`, `https:`, `mailto:` schemes
|
|
31
|
-
- Same-origin paths
|
|
31
|
+
- Same-origin paths — decided by RESOLVING the candidate and comparing origins (`isSameOriginPath`), not by a `/` vs `//` prefix test: the URL parser treats a backslash as a slash in the authority position, so a single-slash path can still land on a third-party host
|
|
32
32
|
- Hash fragments starting with `#`
|
|
33
33
|
|
|
34
34
|
Rejected:
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { UNSAFE_URL_CHARS, isSameOriginPath } from '../../../utils/url-safety';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Compact-card class constants — single source of truth for the chat-inline
|
|
3
5
|
* `size='sm'` card frame.
|
|
@@ -73,11 +75,11 @@ const SAFE_URL_SCHEMES = ['http:', 'https:', 'mailto:'];
|
|
|
73
75
|
export function safeHref(url: string | null | undefined): string | null {
|
|
74
76
|
if (!url) return null;
|
|
75
77
|
// Defense in depth: control chars + zero-width / line-separator chars.
|
|
76
|
-
if (
|
|
78
|
+
if (UNSAFE_URL_CHARS.test(url)) return null;
|
|
77
79
|
const trimmed = url.trim();
|
|
78
80
|
if (!trimmed) return null;
|
|
79
|
-
// Pure same-origin path.
|
|
80
|
-
if (trimmed.startsWith('/')
|
|
81
|
+
// Pure same-origin path — RESOLVED, not prefix-tested. See `isSameOriginPath`.
|
|
82
|
+
if (trimmed.startsWith('/')) return isSameOriginPath(trimmed) ? trimmed : null;
|
|
81
83
|
if (trimmed.startsWith('#')) return trimmed;
|
|
82
84
|
// Reject bare scheme-only inputs.
|
|
83
85
|
if (/^[a-z][a-z0-9+.-]*:$/i.test(trimmed)) return null;
|
package/src/utils/.format.md
CHANGED
|
@@ -18,8 +18,11 @@ Utility functions for consistent formatting of dates, times, numbers, file sizes
|
|
|
18
18
|
| `nameInitials` | Extracts up to two-letter initials from the first and second word; single source of truth for avatar fallbacks |
|
|
19
19
|
| `formatDurationMMSS` | Formats seconds as `MM:SS` or `HH:MM:SS` for media players |
|
|
20
20
|
| `formatDurationCompact` | Formats seconds as `Xh Xm` or `X min` for cards and headers |
|
|
21
|
-
| `formatDurationFromRange` |
|
|
22
|
-
| `formatTimeWithTimezone` |
|
|
21
|
+
| `formatDurationFromRange` | Duration between two timestamps as `1h 30m` / `45m`. Returns `''` for a non-positive or unparseable range — a renderer shows nothing rather than `-45m` |
|
|
22
|
+
| `formatTimeWithTimezone` | An event's wall-clock time in its own IANA zone; falls back to UTC on an unresolvable label. Pair it with `formatDateWithTimezone` so both halves of one timestamp use one zone |
|
|
23
|
+
| `formatDateWithTimezone` | The calendar day in the event's own zone — the sibling of the above |
|
|
24
|
+
| `formatWebinarTimeMeta` | THE time+duration composition every webinar surface renders. Owns the display-override rule (a chosen date has no clock), so no call site can forget it |
|
|
25
|
+
| `formatProgramDate` | THE date half beside it, taking the same resolved `ProgramInstant`. Replaced a `zoned ? formatDateWithTimezone(...) : formatUtc(...)` branch written out at four call sites, whose two arms rendered different shapes |
|
|
23
26
|
|
|
24
27
|
## Usage Example
|
|
25
28
|
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
formatDateWithTimezone,
|
|
5
|
+
formatDurationFromRange,
|
|
6
|
+
formatProgramDate,
|
|
7
|
+
formatTimeWithTimezone,
|
|
8
|
+
formatWebinarTimeMeta,
|
|
9
|
+
} from '../format';
|
|
10
|
+
import { programDateInstant } from '../program-instant';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* These three formatters render the date, time and duration of ONE event, side
|
|
14
|
+
* by side on the program card. They had no coverage at all, which is how a
|
|
15
|
+
* missing sign guard shipped: a live webinar row whose `end_at` preceded its
|
|
16
|
+
* `start_at` printed "-45m" on the card.
|
|
17
|
+
*/
|
|
18
|
+
describe('formatDurationFromRange', () => {
|
|
19
|
+
it('formats a positive range', () => {
|
|
20
|
+
expect(formatDurationFromRange('2026-03-20T00:00:00Z', '2026-03-20T00:45:00Z')).toBe('45m');
|
|
21
|
+
expect(formatDurationFromRange('2026-03-20T00:00:00Z', '2026-03-20T01:30:00Z')).toBe('1h 30m');
|
|
22
|
+
expect(formatDurationFromRange('2026-03-20T00:00:00Z', '2026-03-20T02:00:00Z')).toBe('2h');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('renders NOTHING when the event ends before it starts', () => {
|
|
26
|
+
// The live row that produced the bug report: e6cff6f8, end_at 45 minutes
|
|
27
|
+
// before start_at. It used to render "-45m" — and note that a -90 minute
|
|
28
|
+
// range never reached the `>= 60` branch, so it printed "-90m" rather than
|
|
29
|
+
// "-1h 30m": the output was not merely wrong, it was inconsistently wrong.
|
|
30
|
+
expect(formatDurationFromRange('2026-03-20T00:00:00Z', '2026-03-19T23:15:25Z')).toBe('');
|
|
31
|
+
expect(formatDurationFromRange('2026-03-20T02:00:00Z', '2026-03-20T00:30:00Z')).toBe('');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('renders nothing for a zero-length or unparseable range', () => {
|
|
35
|
+
expect(formatDurationFromRange('2026-03-20T00:00:00Z', '2026-03-20T00:00:00Z')).toBe('');
|
|
36
|
+
// Used to print the literal string "NaNm".
|
|
37
|
+
expect(formatDurationFromRange('not-a-date', '2026-03-20T00:00:00Z')).toBe('');
|
|
38
|
+
expect(formatDurationFromRange('2026-03-20T00:00:00Z', 'not-a-date')).toBe('');
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('renders nothing when an endpoint is missing', () => {
|
|
42
|
+
expect(formatDurationFromRange(null, '2026-03-20T00:00:00Z')).toBe('');
|
|
43
|
+
expect(formatDurationFromRange('2026-03-20T00:00:00Z', undefined)).toBe('');
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
describe('formatDateWithTimezone / formatTimeWithTimezone agree on the zone', () => {
|
|
48
|
+
// The reported defect: the card printed the date in UTC and the time beside
|
|
49
|
+
// it in the event's own zone, so this instant read "Mar 20, 2026 · 9:18 PM"
|
|
50
|
+
// — 9:18 PM on the 20th is not when it happens, 9:18 PM on the 19th is.
|
|
51
|
+
const instant = '2026-03-20T01:18:00Z';
|
|
52
|
+
const zone = 'America/New_York';
|
|
53
|
+
|
|
54
|
+
it('puts the date on the event-local day, not the UTC day', () => {
|
|
55
|
+
expect(formatDateWithTimezone(instant, zone)).toBe('Mar 19, 2026');
|
|
56
|
+
expect(formatTimeWithTimezone(instant, zone)).toBe('9:18 PM');
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('renders the weekday style in the same zone', () => {
|
|
60
|
+
// Note the copy shift: the default density used to build this from the
|
|
61
|
+
// date-fns pattern 'EEEE d MMMM' ("Thursday 19 March"). Intl's en-US order
|
|
62
|
+
// is "Thursday, March 19". Preserving the old wording would mean composing
|
|
63
|
+
// the string from Intl parts by hand — re-introducing exactly the bespoke
|
|
64
|
+
// date arithmetic this change exists to remove — so the locale-correct
|
|
65
|
+
// form wins, consistent with every other formatter in this file.
|
|
66
|
+
expect(formatDateWithTimezone(instant, zone, 'weekday')).toBe('Thursday, March 19');
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('falls back to UTC on both halves when no zone is given', () => {
|
|
70
|
+
expect(formatDateWithTimezone(instant, null)).toBe('Mar 20, 2026');
|
|
71
|
+
expect(formatTimeWithTimezone(instant, null)).toBe('1:18 AM');
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('handles a legacy fixed-offset label consistently across both halves', () => {
|
|
75
|
+
// "EST" does NOT throw — Node resolves it as a legacy fixed UTC-5 alias, so
|
|
76
|
+
// it lands on the 19th at 8:18 PM (no DST, unlike America/New_York's EDT).
|
|
77
|
+
// What matters is that the date and the time agree about the zone.
|
|
78
|
+
expect(formatDateWithTimezone(instant, 'EST')).toBe('Mar 19, 2026');
|
|
79
|
+
expect(formatTimeWithTimezone(instant, 'EST')).toBe('8:18 PM');
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('degrades BOTH halves to UTC on a genuinely invalid zone', () => {
|
|
83
|
+
// A label Intl cannot resolve DOES throw a RangeError. Both formatters must
|
|
84
|
+
// catch it the same way, or the pair disagrees about which zone it used.
|
|
85
|
+
expect(formatDateWithTimezone(instant, 'Not/AZone')).toBe('Mar 20, 2026');
|
|
86
|
+
expect(formatTimeWithTimezone(instant, 'Not/AZone')).toBe('1:18 AM');
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('appends the zone label only when asked', () => {
|
|
90
|
+
expect(formatTimeWithTimezone(instant, zone, { withZoneLabel: true })).toBe('9:18 PM EDT');
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('renders nothing for a missing or unparseable date', () => {
|
|
94
|
+
expect(formatDateWithTimezone(null, zone)).toBe('');
|
|
95
|
+
expect(formatDateWithTimezone('not-a-date', zone)).toBe('');
|
|
96
|
+
expect(formatTimeWithTimezone('not-a-date', zone)).toBe('');
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* The webinar time+duration composition. These exact three lines existed in
|
|
102
|
+
* three surfaces and drifted twice — once so the page read the raw `start_at`
|
|
103
|
+
* while the card read the resolved instant, once so two of three applied the
|
|
104
|
+
* display-override rule. The rule now lives here, so it is tested here.
|
|
105
|
+
*/
|
|
106
|
+
describe('formatWebinarTimeMeta', () => {
|
|
107
|
+
const RANGE = { startAt: '2026-03-20T01:18:00Z', endAt: '2026-03-20T02:18:00Z' };
|
|
108
|
+
// Built through the resolver, never hand-assembled: the helper takes the
|
|
109
|
+
// RESOLVED value precisely so a caller cannot invent a combination the
|
|
110
|
+
// resolver would never produce (which is how four call sites disagreed).
|
|
111
|
+
const zonedRow = { date: RANGE.startAt, start_at: RANGE.startAt, timezone: 'America/New_York' };
|
|
112
|
+
|
|
113
|
+
it('renders the time from the resolved instant and the duration from the range', () => {
|
|
114
|
+
expect(formatWebinarTimeMeta(programDateInstant(zonedRow), RANGE)).toBe('9:18 PM · 1h');
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it('labels the zone when asked', () => {
|
|
118
|
+
expect(formatWebinarTimeMeta(programDateInstant(zonedRow), { ...RANGE, withZoneLabel: true })).toBe(
|
|
119
|
+
'9:18 PM EDT · 1h',
|
|
120
|
+
);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it('drops the CLOCK for a display override, keeping the duration', () => {
|
|
124
|
+
// A chosen display date has no time of day the admin meant.
|
|
125
|
+
const at = programDateInstant({ ...zonedRow, date: '2026-03-19T00:00:00Z', date_is_display_override: true });
|
|
126
|
+
expect(formatWebinarTimeMeta(at, RANGE)).toBe('1h');
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it('leaves no dangling separator when either side is missing', () => {
|
|
130
|
+
const at = programDateInstant(zonedRow);
|
|
131
|
+
expect(formatWebinarTimeMeta(at, { ...RANGE, endAt: null })).toBe('9:18 PM');
|
|
132
|
+
// An inverted range yields no duration — and must not leave a trailing " · ".
|
|
133
|
+
expect(formatWebinarTimeMeta(at, { ...RANGE, endAt: '2026-03-20T00:00:00Z' })).toBe('9:18 PM');
|
|
134
|
+
// An unrenderable time must not leave a LEADING " · " either.
|
|
135
|
+
expect(
|
|
136
|
+
formatWebinarTimeMeta(programDateInstant({ ...zonedRow, date: 'not-a-date', start_at: 'not-a-date' }), RANGE),
|
|
137
|
+
).toBe('1h');
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
it('a zoneless row still renders a deterministic UTC clock, not nothing', () => {
|
|
141
|
+
// `instant` is null without a zone (the React #418 pin), so the helper must
|
|
142
|
+
// fall through to the canonical value rather than dropping the time.
|
|
143
|
+
const at = programDateInstant({ date: RANGE.startAt, start_at: RANGE.startAt });
|
|
144
|
+
expect(at.instant).toBeNull();
|
|
145
|
+
expect(formatWebinarTimeMeta(at, RANGE)).toBe('1:18 AM · 1h');
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it('the two compact surfaces that mirror each other label the zone alike', () => {
|
|
149
|
+
// They took `withZoneLabel` from different expressions, so a zoneless
|
|
150
|
+
// webinar read "1:18 AM UTC" on the public card and "1:18 AM" on the chat
|
|
151
|
+
// card — for one row, on two cards built to look the same.
|
|
152
|
+
const at = programDateInstant({ date: RANGE.startAt, start_at: RANGE.startAt });
|
|
153
|
+
expect(formatWebinarTimeMeta(at, { ...RANGE, withZoneLabel: true })).toBe('1:18 AM UTC · 1h');
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
describe('a day-valued row leaves nothing for a consumer to mislabel', () => {
|
|
158
|
+
// The worst shape this rule can produce, and the one three surfaces rendered:
|
|
159
|
+
// an override supplies the day (so no clock), `end_at` is null (so no
|
|
160
|
+
// duration), and the composition is EMPTY — beside which two of the three
|
|
161
|
+
// surfaces still printed the row's bare IANA zone, captioning nothing.
|
|
162
|
+
//
|
|
163
|
+
// `end_at` being null is not hypothetical: the Livestorm ingest guard nulls
|
|
164
|
+
// it on an inverted range, which is exactly the corrupt-row case that guard
|
|
165
|
+
// was added for.
|
|
166
|
+
it('empty meta and no zone, so the slot renders nothing at all', () => {
|
|
167
|
+
const at = programDateInstant({
|
|
168
|
+
date: '2026-03-19T00:00:00.000Z',
|
|
169
|
+
start_at: '2026-03-20T01:18:00.000Z',
|
|
170
|
+
timezone: 'America/New_York',
|
|
171
|
+
date_is_display_override: true,
|
|
172
|
+
});
|
|
173
|
+
expect(at.timezone).toBeNull();
|
|
174
|
+
expect(formatWebinarTimeMeta(at, { startAt: '2026-03-20T01:18:00.000Z', endAt: null, withZoneLabel: true })).toBe(
|
|
175
|
+
'',
|
|
176
|
+
);
|
|
177
|
+
// ...while the DATE is still stated, and states the day the admin chose.
|
|
178
|
+
expect(formatProgramDate(at, 'weekday')).toBe('Thursday, March 19');
|
|
179
|
+
});
|
|
180
|
+
});
|