com.vaadin.flow.component.datepicker.
Class DatePicker.DatePickerI18n
- java.lang.Object
-
- com.vaadin.flow.component.datepicker.DatePicker.DatePickerI18n
-
All Implemented Interfaces:
Enclosing class:
public static class DatePicker.DatePickerI18n extends Object implements Serializable
The internationalization properties for
DatePicker
.See Also:
-
-
Constructor Summary
Constructors Constructor Description DatePickerI18n()
-
Method Summary
All Methods Modifier and Type Method Description String
getCalendar()
Deprecated.
the toggle button is no longer announced by screen readers, so this property is now unused.String
getCancel()
Gets the translated word for
cancel
.String
getClear()
Deprecated.
the clear button is no longer announced by screen readers, so this property is now unused.List<String>
getDateFormats()
Get the list of custom date formats that are used for formatting the date displayed in the text field, and for parsing the user input
int
getFirstDayOfWeek()
Gets the first day of the week.
List<String>
getMonthNames()
Gets the name of the months.
String
getToday()
Gets the translated word for
today
.String
getWeek()
Gets the translated word for
week
.List<String>
getWeekdays()
Gets the name of the week days.
List<String>
getWeekdaysShort()
Gets the short names of the week days.
DatePicker.DatePickerI18n
setCalendar(String calendar)
Deprecated.
the toggle button is no longer announced by screen readers, so this property is now unused.DatePicker.DatePickerI18n
setCancel(String cancel)
Sets the translated word for
cancel
.DatePicker.DatePickerI18n
setClear(String clear)
Deprecated.
the clear button is no longer announced by screen readers, so this property is now unused.DatePicker.DatePickerI18n
setDateFormat(String dateFormat)
Sets a custom date format to be used by the date picker.
DatePicker.DatePickerI18n
setDateFormats(String primaryFormat, String... additionalParsingFormats)
Sets custom date formats to be used by the date picker.
DatePicker.DatePickerI18n
setFirstDayOfWeek(int firstDayOfWeek)
Sets the first day of the week.
DatePicker.DatePickerI18n
setMonthNames(List<String> monthNames)
Sets the name of the months, starting from January and ending on December.
DatePicker.DatePickerI18n
setToday(String today)
Sets the translated word for
today
.DatePicker.DatePickerI18n
setWeek(String week)
Sets the translated word for
week
.DatePicker.DatePickerI18n
setWeekdays(List<String> weekdays)
Sets the name of the week days, starting from
Sunday
and ending onSaturday
.DatePicker.DatePickerI18n
setWeekdaysShort(List<String> weekdaysShort)
Sets the short names of the week days, starting from
sun
and ending onsat
.
-
-
-
Method Detail
-
getMonthNames
public List<String> getMonthNames()
Gets the name of the months.
Returns:
the month names
-
setMonthNames
public DatePicker.DatePickerI18n setMonthNames(List<String> monthNames)
Sets the name of the months, starting from January and ending on December.
Parameters:
monthNames
- the month namesReturns:
this instance for method chaining
-
getWeekdays
public List<String> getWeekdays()
Gets the name of the week days.
Returns:
the week days
-
setWeekdays
public DatePicker.DatePickerI18n setWeekdays(List<String> weekdays)
Sets the name of the week days, starting from
Sunday
and ending onSaturday
.Parameters:
weekdays
- the week days namesReturns:
this instance for method chaining
-
getWeekdaysShort
public List<String> getWeekdaysShort()
Gets the short names of the week days.
Returns:
the short names of the week days
-
setWeekdaysShort
public DatePicker.DatePickerI18n setWeekdaysShort(List<String> weekdaysShort)
Sets the short names of the week days, starting from
sun
and ending onsat
.Parameters:
weekdaysShort
- the short names of the week daysReturns:
this instance for method chaining
-
getDateFormats
public List<String> getDateFormats()
Get the list of custom date formats that are used for formatting the date displayed in the text field, and for parsing the user input
Returns:
list of date patterns or null
-
setDateFormat
public DatePicker.DatePickerI18n setDateFormat(String dateFormat)
Sets a custom date format to be used by the date picker. The format is used for formatting the date displayed in the text field, and for parsing the user input.
The format is a string pattern using specific symbols to specify how and where the day, month and year should be displayed. The following symbols can be used in the pattern:
yy
- 2 digit yearyyyy
- 4 digit yearM
- Month, as 1 or 2 digitsMM
- Month, padded to 2 digitsd
- Day-of-month, as 1 or 2 digitsdd
- Day-of-month, padded to 2 digits
For example
dd/MM/yyyy
, will format the 20th of June 2021 as20/06/2021
.Using a custom date format overrides the locale set in the date picker.
Setting the format to null will revert the date picker to use the locale for formatting and parsing dates.
Parameters:
dateFormat
- A string with a date format pattern, or null to remove the previous custom formatReturns:
this instance for method chaining
-
setDateFormats
public DatePicker.DatePickerI18n setDateFormats(String primaryFormat, String... additionalParsingFormats)
Sets custom date formats to be used by the date picker. The primary format is used for formatting the date displayed in the text field, and for parsing the user input. Additional parsing formats can be specified to support entering dates in multiple formats. The date picker will first attempt to parse the user input using the primary format. If parsing with the primary format fails, it will attempt to parse the input using the additional formats in the order that they were specified. The additional parsing formats are never used for formatting the date. After entering a date using one of the additional parsing formats, it will still be displayed using the primary format.
See
setDateFormat(String)
on how date patterns are structured.Using custom date formats overrides the locale set in the date picker.
Setting the primary format to null will revert the date picker to use the locale for formatting and parsing dates.
Parameters:
primaryFormat
- A string with a date format pattern, or null to remove the previous custom formatadditionalParsingFormats
- Additional date format patterns to be used for parsingReturns:
this instance for method chaining
-
getFirstDayOfWeek
public int getFirstDayOfWeek()
Gets the first day of the week.
0 for Sunday, 1 for Monday, 2 for Tuesday, 3 for Wednesday, 4 for Thursday, 5 for Friday, 6 for Saturday.
Returns:
the index of the first day of the week
-
setFirstDayOfWeek
public DatePicker.DatePickerI18n setFirstDayOfWeek(int firstDayOfWeek)
Sets the first day of the week.
0 for Sunday, 1 for Monday, 2 for Tuesday, 3 for Wednesday, 4 for Thursday, 5 for Friday, 6 for Saturday.
Parameters:
firstDayOfWeek
- the index of the first day of the weekReturns:
this instance for method chaining
Throws:
IllegalArgumentException
- if firstDayOfWeek is invalid
-
getWeek
public String getWeek()
Gets the translated word for
week
.Returns:
the translated word for week
-
setWeek
public DatePicker.DatePickerI18n setWeek(String week)
Sets the translated word for
week
.Parameters:
week
- the translated word for weekReturns:
this instance for method chaining
-
getCalendar
@Deprecated public String getCalendar()
Deprecated.the toggle button is no longer announced by screen readers, so this property is now unused.Gets the translated word for
calendar
.Returns:
the translated word for calendar
-
setCalendar
@Deprecated public DatePicker.DatePickerI18n setCalendar(String calendar)
Deprecated.the toggle button is no longer announced by screen readers, so this property is now unused.Sets the translated word for
calendar
.Parameters:
calendar
- the translated word for calendarReturns:
this instance for method chaining
-
getClear
@Deprecated public String getClear()
Deprecated.the clear button is no longer announced by screen readers, so this property is now unused.Gets the translated word for
clear
.Returns:
the translated word for clear
-
setClear
@Deprecated public DatePicker.DatePickerI18n setClear(String clear)
Deprecated.the clear button is no longer announced by screen readers, so this property is now unused.Sets the translated word for
clear
.Parameters:
clear
- the translated word for clearReturns:
this instance for method chaining
-
getToday
public String getToday()
Gets the translated word for
today
.Returns:
the translated word for today
-
setToday
public DatePicker.DatePickerI18n setToday(String today)
Sets the translated word for
today
.Parameters:
today
- the translated word for todayReturns:
this instance for method chaining
-
getCancel
public String getCancel()
Gets the translated word for
cancel
.Returns:
the translated word for cancel
-
setCancel
public DatePicker.DatePickerI18n setCancel(String cancel)
Sets the translated word for
cancel
.Parameters:
cancel
- the translated word for cancelReturns:
this instance for method chaining
-
-