format

sets a date format to display in the datepicker field

string|object format;

Example

format: "%m.%d.%Y" // setting and getting datepicker values by the specified template

Related samples

Details

The format property can be set as an object or as a string. It defines how a datepicker will get (and render) and set data.

When the format is specified as a string, it is expected that a value set into the datepicker will also be in the string format.

When set as an object, the config has two properties: get and set. They can also be set either as a function, or as a string. For example:

format: {
  get: "%d %M %Y", // getValue() will return a text by the specified template
  set: "%Y %m %d" // setValue() will convert a string into a date by the template
}
 
// or
format: {
  get: date => webix.Date.dateToStr("%M/%Y")(date),
  set: text => webix.Date.strToDate("%Y-%m-%d")(text)
}

You can find all the supported specificators in the corresponding section.

See also
Back to top
Join Our Forum
We've retired comments here. Visit our forum for faster technical support, connect with other developers, and share your feedback there.