Skip to main content

format

Description

Optional. Sets the date format for a date picker input

Usage

format?: string | ((value: Date) => string);

Parameters

  • string - a format string that defines how the date should be displayed in the input. The default value is "%m/%d/%Y".
  • function (value: Date) => string - a custom formatting function that takes a Date object and returns a formatted string

Example

<DatePicker value={new Date()} format="%d %F, %Y" />

Details

You can set the format property as a string or as a function that returns a formatted string.

Check the characters available for specifying the date format.

Related article: Setting the date format

Related sample: DatePicker