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#
npm install et-calendarYarn 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.
Selected: 2026-11-21 · Ethiopian: ህዳር 12, 2019
| Prop | Type | Default | Description |
|---|---|---|---|
selectedDate | Date | — | 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. |
dateFormat | string | "MMMM dd, yyyy" | Trigger format. Time tokens are ignored. |
minDate / maxDate | Date | — | Selectable bounds. |
clampNavigation | boolean | false | Stop paging outside min/max months. |
closeOnSelect | boolean | true | Close the popover after a pick. |
popoverProps | PopoverProps | — | anchor / align / sideOffset / alignOffset. |
DateTimePicker#
The date picker plus a time list, in 12- or 24-hour format.
Value: 11/21/2026, 2:30:00 PM
DateRangePicker#
Start/end selection with a preview band. Two months on desktop, one on phones.
Pick a start day, then an end day.
Behaviour
minNights/maxNights, or rejected by disabledDays, render disabled.| Prop | Type | Default | Description |
|---|---|---|---|
value | DateRange | — | Controlled range: { start?, end? }. |
defaultValue | DateRange | — | Initial range when uncontrolled. |
onChange* | (range: DateRange) => void | — | Called once a complete range is picked. |
minNights / maxNights | number | — | Allowed nights between the ends. |
numberOfMonths | 1 | 2 | 3 | 2 / 1 responsive | Visible months. |
showCalendars | "ethiopian" | "gregorian" | "both" | "both" | Which calendars to render. |
disabledDays | (date: Date) => boolean | — | Days that can never be selected. |
closeOnSelect | boolean | true | Close when the range completes. |
Formatting#
Pure formatters for display strings, using Luxon tokens.
Gregorian: 2026-11-21 · Ethiopian: ህዳር 12, 2019 14:30
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.
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.
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); // trueTheming#
Colours come from CSS variables, so plain CSS is enough — no Tailwind in your app.
: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
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.
- Repository and README — full prop tables, hooks and utilities.
- npm package — changelog and versions.
- Issues — bug reports and feature requests.