Files
whenkit/dist/labels.d.ts
CatoandClaude Opus 5.5 a787a7ba8e feat: whenkit 0.1.0 — pick dates and times without typing (#1)
Day chips, time chips, length chips, a readable date field over the native
picker, and a booking request that resolves to {startsAt, endsAt} in the
provider's zone.

- Core (no React): wall-clock YYYY-MM-DD / HH:MM strings, one zonedToUtc
  (DST gaps resolve forward), todayIn(zone), slots inside opening hours,
  lengths that fit, resolveRequest / describeRequest for three choices:
  slot, days, flexible.
- React: BookingRequestPicker, DayStrip, ChipGroup (real radio groups),
  DateField (native input transparent over a readable display).
- styles.css: --wk-* variables defaulting to @bitbaum/design-tokens; 44px
  targets, 16px input, strip scrolls inside itself.
- Tests: 15 core + 8 server-render, and a Chromium check at 1280/390,
  light/dark that taps bookings end to end. dist/ committed for github: installs.

Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-08 02:50:10 -07:00

33 lines
1.2 KiB
TypeScript

/**
* How a day, a time and a length read to a person — in their language.
*
* Every string here comes from `Intl`, so "Today", "morgen" and "demain" are
* the platform's words rather than a table this package would have to keep.
* Days are formatted from their UTC anchor with `timeZone: "UTC"`, so the
* label is always the day that was picked.
*/
import { type ISODate, type WallTime } from "./calendar.js";
export interface DayLabel {
date: ISODate;
/** "Sat" */
weekdayShort: string;
/** "11" */
dayOfMonth: string;
/** "Oct" */
monthShort: string;
/** "Today" / "Tomorrow" (in the locale), otherwise null. */
relative: string | null;
/** "Saturday, 11 October" — for screen readers and summaries. */
long: string;
/** "Sat 11 Oct" */
short: string;
}
export declare function dayLabel(date: ISODate, opts?: {
locale?: string;
today?: ISODate;
}): DayLabel;
/** "14:00" or "2:00 PM", whichever the locale uses. */
export declare function formatTime(time: WallTime, locale?: string): string;
/** "30 min", "2 hr", "1 day" — the locale's own short unit words. */
export declare function formatLength(minutes: number, locale?: string): string;
//# sourceMappingURL=labels.d.ts.map