Date

Date control

Parameters you can pass

ParameterData typeDescription
typestringsingle or range
namestringInput name, if range, it must be an object (name.from and name.to)
valuestringValue, if range, must be separated by a hyphen (30.07.2020-31.07.2020)
idstringInput ID
class_namestringWrapper class (if several classes passed, divide them by Space)
placeholderstringPlaceholder
disabledboolShows if it's disabled

📘

The date format is DD.MM.YYYY.

Default date

 self.render({ ref: '/tmpl/controls/date_field.twig' }, {
    name: 'date',
    placeholder: 'Select date'
  });

Range

self.render(
          { ref: "/tmpl/controls/date_field.twig" },
          {
            type: "range",
            name: { from: "date_1", to: "date_2" },
          }
        );

The input of type range in the DOM is rendered with two hidden inputs whose values are the first and second dates from the range. By assigning them names in the object, it would be easier to access them.

Disabled

self.render({ ref: '/tmpl/controls/date_field.twig' }, {
    name: 'date',
    disabled: true
  });