Files
cinny/src/app/utils/a11y.ts
T

15 lines
648 B
TypeScript
Raw Normal View History

import { TimestampPrefs, formatTimestamp } from './formatTimestamp';
/**
* Builds a plain-text accessible label for a message row, used when the
* visible sender/timestamp header is collapsed and therefore hidden from
* assistive technology.
*
* @param sender - Sender display name (already resolved to a human string).
* @param ts - Message origin timestamp in milliseconds.
* @param prefs - The user's clock/date preferences.
* @returns A label such as `Alice, 1 Jul 2026 14:30`.
*/
export const messageAriaLabel = (sender: string, ts: number, prefs: TimestampPrefs): string =>
`${sender}, ${formatTimestamp(ts, prefs, 'dateTime')}`;