React Website SectionsComponents
PublishScheduler
Capture a publication date/time with an explicit IANA timezone and hand it to the host scheduler.
PublishScheduler collects a local date/time and explicit IANA timezone, then calls the supplied callback with an absolute Date and timezone. It is not a worker and never publishes content by itself.
API
| Prop | Type | Required | Default |
|---|---|---|---|
onSchedule | (publishAt: Date, timeZone: string) => void | Promise<void> | Yes | — |
scheduledAt | Date | string | null | No | null |
timeZone | string | No | Browser IANA timezone |
onCancelSchedule | () => void | Promise<void> | No | — |
disabled / scheduling | boolean | No | false |
className | string | No | — |
import { createCmsClient } from "@puzzle-ui/fullstack/cms/client";
import { PublishScheduler } from "@puzzle-ui/pieces";
const cms = createCmsClient({ basePath: "/api/cms" });
const articles = cms.collection("articles");
<PublishScheduler
scheduledAt={entry.scheduledAt}
timeZone={entry.scheduledTimeZone ?? "UTC"}
onSchedule={async (publishAt, timeZone) => {
await articles.schedulePublish(entry.id, {
expectedRevision: entry.revision,
publishAt: publishAt.toISOString(),
timeZone,
});
}}
onCancelSchedule={async () => {
await articles.unschedule(entry.id, {
expectedRevision: entry.revision,
});
}}
/>;Nonexistent daylight-saving local times are rejected visibly. If a local time occurs twice during a clock rollback, the earlier instant is selected. This component only collects a date/time; schedule operations are available when the server configures a CMS scheduler.
Related
API maturity
API maturity: Stable.