Skip to Content

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.

390 × 844

API

PropTypeRequiredDefault
onSchedule(publishAt: Date, timeZone: string) => void | Promise<void>Yes—
scheduledAtDate | string | nullNonull
timeZonestringNoBrowser IANA timezone
onCancelSchedule() => void | Promise<void>No—
disabled / schedulingbooleanNofalse
classNamestringNo—
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.

API maturity

API maturity: Stable.