Documentation

et-calendar

React components and utilities for the Ethiopian and Gregorian calendars. Date pickers, a two-month range picker, formatting hooks and day-exact conversions — typed end to end and correct in every time zone.

Two calendars

Ethiopian, Gregorian, or both side by side in one popover.

Range selection

Start/end ranges with a hover preview and night limits.

Time-zone correct

Day arithmetic on calendar days, never on raw timestamps.

Themable

Plain CSS variables — no Tailwind required in your app.

Installation#

terminal
npm install et-calendar

Yarn and pnpm work too: yarn add et-calendar or pnpm add et-calendar.

DatePicker#

A single-date picker with Ethiopian and Gregorian tabs, min/max bounds and clamped navigation.

DatePicker
Gregorian first
Ethiopian first

Selected: 2026-11-21 · Ethiopian: ህዳር 12, 2019

PropTypeDefaultDescription
selectedDateDate—Currently selected date.
onDateChange*(date: Date) => void—Called when a day is picked.
showCalendars"ethiopian" | "gregorian" | "both"—Which calendar(s) to render.
viewFirst"Ethiopian" | "Gregorian""Gregorian"First tab, and the calendar used for the trigger label.
dateFormatstring"MMMM dd, yyyy"Trigger format. Time tokens are ignored.
minDate / maxDateDate—Selectable bounds.
clampNavigationbooleanfalseStop paging outside min/max months.
closeOnSelectbooleantrueClose the popover after a pick.
popoverPropsPopoverProps—anchor / align / sideOffset / alignOffset.

DateTimePicker#

The date picker plus a time list, in 12- or 24-hour format.

DateTimePicker
Gregorian first
Ethiopian first

Value: 11/21/2026, 2:30:00 PM

DateRangePicker#

Start/end selection with a preview band. Two months on desktop, one on phones.

DateRangePicker
Gregorian first
Ethiopian first

Pick a start day, then an end day.

Behaviour

Picking a day earlier than the pending start restarts the range. Days outside minNights/maxNights, or rejected by disabledDays, render disabled.
PropTypeDefaultDescription
valueDateRange—Controlled range: { start?, end? }.
defaultValueDateRange—Initial range when uncontrolled.
onChange*(range: DateRange) => void—Called once a complete range is picked.
minNights / maxNightsnumber—Allowed nights between the ends.
numberOfMonths1 | 2 | 32 / 1 responsiveVisible months.
showCalendars"ethiopian" | "gregorian" | "both""both"Which calendars to render.
disabledDays(date: Date) => boolean—Days that can never be selected.
closeOnSelectbooleantrueClose when the range completes.

Formatting#

Pure formatters for display strings, using Luxon tokens.

Gregorian: 2026-11-21 · Ethiopian: ህዳር 12, 2019 14:30

format.ts
import { useFormattedDate, useFormattedEthiopianDateTime } from "et-calendar/hooks";
import { EthiopianDate } from "et-calendar/lib";

export function FormattedLabels({ date }: { date: Date }) {
  const gregorian = useFormattedDate(date, "yyyy-MM-dd");
  // "2026-11-21"

  const ethiopian = useFormattedEthiopianDateTime(
    EthiopianDate.toEthDateTime(date),
    "MMMM dd, yyyy HH:mm"
  );
  // "ህዳር 12, 2019 14:30"

  return (
    <p>
      {gregorian} · {ethiopian}
    </p>
  );
}

EthiopianDate#

Conversions between the two calendars, in both directions.

EthiopianDate
2026-11-21 → {"Year":2019,"Month":3,"Day":12}
2015-01-01 → Sun Sep 11 2022
month 1 → መስከረም / Meskerem

Time zones

toGreg and toGregDateTime return local midnight of the correct Gregorian day, so local getters report the right date in every zone.

Calendar-day helpers#

Day-number arithmetic exported from et-calendar/lib. Use these instead of subtracting timestamps.

days.ts
import { addDays, differenceInDays, isBetween } from "et-calendar/lib";

// Nights between two stays — an integer number of calendar days.
differenceInDays(checkOut, checkIn); // 7

// Whole-day arithmetic that never drifts across a DST boundary.
addDays(new Date(2024, 1, 28), 1); // 2024-02-29

isBetween(new Date(2024, 0, 15), start, end); // true

Theming#

Colours come from CSS variables, so plain CSS is enough — no Tailwind in your app.

globals.css
:root {
  --selected-background-color: #2563eb;
  --selected-hover-background-color: #1e40af;
  --selected-text-color: #ffffff;
  --today-background-color: #e5e7eb;
}

Overriding these in :root restyles the single-date pickers and the range picker together, because the range band is derived from the same tokens.

Dark mode

The package ships a dark token set, so a dark class on <html> (or any wrapper) is all it takes. This site relies on it — toggle the theme in the header to see the pickers, tabs and time list switch.

Resources#

Everything else lives in the repository.

MIT licensed · Built for the Ethiopian and Gregorian calendars.