Skip to content
العربية
Saudi forms and dates

Calendar

Gregorian or Hijri (Umm al-Qura) month grid; each day also shows its number in the other calendar. Weeks start on Sunday. The month and year lists go to any month: the years from min to max, else 100 years back and 10 years forward; months outside min and max are disabled. mode="range" chooses a date range: the first day is the start, the second the end.

import { Calendar, nextRange, type DateRange } from "@percentsa/ui";

Examples

Ramadan 1447 AH

SunMonTueWedThuFriSat

value: 2026-02-18

Code
export function CalendarExample() {
  const [day, setDay] = useState<PlainDate | null>("2026-02-18");
  return (
    <Stack gap={3}>
      <Calendar value={day} onValueChange={setDay} defaultCalendar="hijri" />
      <Text size="sm" tone="subtle" dir="ltr">value: {day}</Text>
    </Stack>
  );
}

February 2026

SunMonTueWedThuFriSat

value: {"from":"2026-02-10","to":"2026-02-18"}

Code
export function CalendarRangeExample() {
  const [range, setRange] = useState<DateRange>({ from: "2026-02-10", to: "2026-02-18" });
  return (
    <Stack gap={3}>
      <Calendar mode="range" value={range} onValueChange={setRange} fixedCalendar />
      <Text size="sm" tone="subtle" dir="ltr">
        value: {JSON.stringify(range)}
      </Text>
    </Stack>
  );
}