Skip to main content

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 given format.
  • 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 year
  • YY1 2-digit year of the first year in current decade
  • YY2 2-digit year of the last year in current decade
  • YYYY full year
  • YYYY1 full year of the first year in current decade
  • YYYY2 full year of the last year in current decade
  • M month
  • MM month with leading zero
  • MMM short month name
  • MMMM full month name
  • D day
  • DD day with leading zero
  • d weekday index
  • dd min weekday name
  • ddd short weekday name
  • dddd 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 - If true, 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 - If short, short weekday name will be returned. If min, min weekday name will be returned.