# Calendar and scheduling

Show events on a calendar, handle edits, or calculate dates in a timezone.

## Choose calendar calculations or a React view

Use Calendar core for date calculations and event layout. Render [Calendar](/components/calendar) when people need to browse or edit events. For a form field, use [Date input](/components/date-input), [Date picker](/components/date-picker), [Time input](/components/time-input), or [Time picker](/components/time-picker).

## Try calendar calculations

Install [the npm package](/docs/installation#package) and import from @collectivecreation/ghost-ui/calendar-core. The core works without React or CSS.

```ts
import { getCalendarDay, parseCalendarDate } from "@collectivecreation/ghost-ui/calendar-core";

const date = "2026-10-26";
const day = getCalendarDay(date, "America/Los_Angeles");
console.log(parseCalendarDate(date), day.minutes);
```

This example prints the parsed date and 1440, the number of minutes in that local day. A day that crosses a daylight-saving change can have 1,380 or 1,500 minutes.

## Render an editable calendar

Load the [shared component styles](/docs/installation#package), then render TeamCalendar. You can navigate to another date or edit an event. The example keeps changes in React state.

```tsx
import { useState } from "react";
import { Calendar } from "@collectivecreation/ghost-ui/components/calendar";
import type { CalendarEvent } from "@collectivecreation/ghost-ui/calendar-core";
export function TeamCalendar() {
  const [date, setDate] = useState("2026-10-30");
  const [events, setEvents] = useState<CalendarEvent[]>([{
    id: "review", title: "Design review",
    start: "2026-10-30T09:00:00+07:00", end: "2026-10-30T09:30:00+07:00",
  }]);
  return <Calendar date={date} onDateChange={setDate} timeZone="Asia/Jakarta"
    events={events} editable onEventChange={next => setEvents(current =>
      current.map(event => event.id === next.id ? next : event))} />;
}

```

Use renderEvent to customize what appears inside an event. See the [Calendar component API](/components/calendar#api) for rendering options.

## Supply events and a timezone

Pass events, resources, the visible date, and an IANA timezone such as Asia/Jakarta. Timed events need a timestamp with Z or a numeric offset. For all-day events, end is the first date outside the event. See [Calendar data](/libraries/calendar-data) for examples and validation rules.

## Save event changes

Apply accepted edits to events from onEventChange. Your app saves the change and handles conflicts or failures. If you expand a recurrence rule or check appointment availability, do that in your app before passing events to Calendar. See [Calendar state](/libraries/calendar-state) for edit rules and timezone changes.

## API reference

See the [Calendar core API](/libraries/calendar-api) for date calculations and event changes. See the [Calendar component](/components/calendar) for view props and examples.

## Troubleshooting

- The date or view stays the same. Update the controlled date or view in its change callback.

- An event appears on the wrong day. Check the timestamp and the view’s timezone.

- An edit has no effect. Check editable, onEventChange, and the event’s own edit permission. Point events cannot be resized.
