Converter
Converter instance for convert date to datepicker's locale format
Methods
format
Convert date to given format string.
(value: any, format: string) => string;
value
- The date to format. If date value is not valid, function will return givenformat
.format
- The format string to convert. (e.g.YYYY-MM-DD
). dateFormat options can be used.
Get the formatted date according to the string.
If you want to pass escape characters, you can use square brackets
to wrap the text.
(e.g. YYYY [escaped text] MM
will output 2024 escaped text 01
)
YY
2-digit yearYY1
2-digit year of the first year in current decadeYY2
2-digit year of the last year in current decadeYYYY
full yearYYYY1
full year of the first year in current decadeYYYY2
full year of the last year in current decadeM
monthMM
month with leading zeroMMM
short month nameMMMM
full month nameD
dayDD
day with leading zerod
weekday indexdd
min weekday nameddd
short weekday namedddd
full weekday name
time
Convert date to time format string.
(value: any) => string;
value
- The date to format.
date
Convert date to date format string.
(value: any) => string;
value
- The date to format.
localeMonth
Convert month index to locale month name.
(monthindex: number, short?: boolean) => string;
monthindex
- The month index to convert.short
- Iftrue
, short month name will be returned.
localeWeekday
Convert weekday index to locale weekday name.
(weekdayindex: number, options?: 'short' | 'min') => string;
weekdayindex
- The weekday index to convert.options
- Ifshort
, short weekday name will be returned. Ifmin
, min weekday name will be returned.