Additionally
Localization
The top-level key locale
is used to manually localize the calendar. Only works if settings.lang
is set to define
.
locale
allows you to set your own names for months and weeks.
If your locale is supported by .toLocaleString()
, you can pass a language tag to the settings.lang
parameter, without the need for manual localization.
You can find support for your language tag here BCP 47.
The locale
key has two keys months
and weekday
, both of which accept an array of strings.
It is important to know that both options are required when settings.lang
is set to define
.
locale.months
Type: String[]
Default: []
Options: String[] | []
js
new VanillaCalendar('#calendar', {
settings: {
lang: 'define',
},
locale: {
months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
},
});
js
new VanillaCalendar('#calendar', {
settings: {
lang: 'define',
},
locale: {
months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
},
});
locale.weekday
Type: String[]
Default: []
Options: String[] | []
js
new VanillaCalendar('#calendar', {
settings: {
lang: 'define',
},
locale: {
weekday: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
},
});
js
new VanillaCalendar('#calendar', {
settings: {
lang: 'define',
},
locale: {
weekday: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
},
});