biletiki.store — a website example for searching for flight tickets and hotels using vanilla-calendar.
Localization
The top-level locale
key is used for manual localization of the calendar. This key works only if the settings.lang
parameter is set to 'define'
. locale
allows you to set your own names for months and weekdays.
If your language tag is supported by the .toLocaleString()
method, you can pass that language tag to the settings.lang
parameter without the need for manual localization.
You can find information about your language tag support here (BCP 47).
The locale
key contains two sub-keys: months
and weekday
. Both of these keys take an array of strings.
Both keys are required if the settings.lang
parameter is set to 'define'
.
locale.months
Type: String[]
Default: []
Options: String[] | []
new VanillaCalendar('#calendar', {
settings: {
lang: 'define',
},
locale: {
months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
},
});
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[] | []
new VanillaCalendar('#calendar', {
settings: {
lang: 'define',
},
locale: {
weekday: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
},
});
new VanillaCalendar('#calendar', {
settings: {
lang: 'define',
},
locale: {
weekday: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
},
});