2026-09-20 00:28:47 -04:00
|
|
|
import { TimestampPrefs, formatTimestamp } from './formatTimestamp';
|
2026-07-02 11:45:21 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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.
|
2026-09-20 00:28:47 -04:00
|
|
|
* @param prefs - The user's clock/date preferences.
|
|
|
|
|
* @returns A label such as `Alice, 1 Jul 2026 14:30`.
|
2026-07-02 11:45:21 -04:00
|
|
|
*/
|
2026-09-20 00:28:47 -04:00
|
|
|
export const messageAriaLabel = (sender: string, ts: number, prefs: TimestampPrefs): string =>
|
|
|
|
|
`${sender}, ${formatTimestamp(ts, prefs, 'dateTime')}`;
|