timepicker-ui
4.6.0GitHub
timepicker-ui
Features / Decorated Dates

Decorated Dates

Mark days with a badge, a class or an accessible label. This page documents @pglejzer/datepicker-ui, the companion of timepicker-ui.

Badges with labels

#

calendar.decorateDate receives each day as a Date and returns a DateDecoration or undefined. badge: true draws a small dot, label is appended to the accessible name of the day, and className adds a class to the day cell. Here the 1st and the 15th of every month get a badge.

Badges
import DatepickerUI from "@pglejzer/datepicker-ui";
import "@pglejzer/datepicker-ui/index.css";
new DatepickerUI("#date", {
calendar: {
decorateDate: (date) => {
if (date.getDate() === 1) return { badge: true, label: "Billing day" };
if (date.getDate() === 15) return { badge: true, label: "Payday" };
return undefined;
},
},
}).create();
Esc