timepicker-ui
4.6.0GitHub
timepicker-ui
Features / Localization

Localization

Month and weekday names, the input format and the first day of the week follow a locale. This page documents @pglejzer/datepicker-ui, the companion of timepicker-ui.

German

#

calendar.locale is a BCP 47 tag. Without it the picker uses <html lang>, then navigator.language, then en-US. Month and weekday names come from Intl.

de-DE
import DatepickerUI from "@pglejzer/datepicker-ui";
import "@pglejzer/datepicker-ui/index.css";
new DatepickerUI("#date", {
calendar: { locale: "de-DE" },
}).create();

Japanese

#
ja-JP
import DatepickerUI from "@pglejzer/datepicker-ui";
import "@pglejzer/datepicker-ui/index.css";
new DatepickerUI("#date", {
calendar: { locale: "ja-JP" },
}).create();

Arabic, right to left

#

calendar.locale sets the language, digits and names. The calendar is mirrored when the input has dir="rtl", or inherits it from the page.

ar-EG
<input id="date" dir="rtl" />
import DatepickerUI from "@pglejzer/datepicker-ui";
import "@pglejzer/datepicker-ui/index.css";
new DatepickerUI("#date", {
calendar: { locale: "ar-EG" },
}).create();

First day of the week

#

calendar.weekStart is "auto" by default and follows the locale. Set a weekday name to override it.

Monday first
import DatepickerUI from "@pglejzer/datepicker-ui";
import "@pglejzer/datepicker-ui/index.css";
new DatepickerUI("#date", {
calendar: { weekStart: "monday" },
}).create();

Note

The buttons and messages are not translated by the locale. Set them in labels.
Esc