@sprigr/apps-timezone-picker
v0.2.1
Published
IANA timezone data plus a server-rendered `<TimezoneSelect>` for Sprigr marketplace apps that collect a "pick your timezone" form value.
Readme
@sprigr/apps-timezone-picker
IANA timezone data plus a server-rendered <TimezoneSelect> for Sprigr marketplace apps that collect a "pick your timezone" form value.
npm install @sprigr/apps-timezone-pickerimport { TimezoneSelect, isKnownTimezone } from '@sprigr/apps-timezone-picker';
<TimezoneSelect name="timezone" defaultValue={saved ?? 'UTC'} />;Validate on the way back in, before persisting:
const tz = String(form.get('timezone') ?? '');
if (!isKnownTimezone(tz)) return badRequest('unknown timezone');Exports
TimezoneSelect— native grouped<select>with<optgroup>. Pure SSR: no"use client"boundary and no client-bundle bytes, and mobile browsers give you a system picker for free. Props:name(required),defaultValue(falls back toUTC),required(default true),style,className,id,ariaLabel.TimezoneSelectPropsis exported alongside it.TIMEZONE_GROUPS— timezones grouped by region, the order the component renders.ALL_TIMEZONES— flat list of every IANA zone offered.isKnownTimezone(value)— validate a submitted value before persisting it.
react is a peer dependency (^19); it is not bundled.
