DateRangeField
A compound field for editing a start/end date pair. The two Date values are stored together in the value property as an object with startDate and endDate keys. A dropdown picker with dual month calendars lets the user select the range visually. By default the picker edits the value live; enable confirmable to require explicit OK/Cancel confirmation. Clicking or arrow-keying in the picker adjusts whichever date field currently has focus. Calendar cells can be customized via cellRenderer.
By default, the picker displays below the fields and edits the value "live":
const dateRange = new DateRangeField({
label : 'Project dates',
value : {
startDate : new Date(2025, 0, 1),
endDate : new Date(2025, 5, 30)
},
appendTo : document.body
});
Useful configs and properties
| Config | Description |
|---|---|
| value | An object with startDate and endDate properties |
| confirmable | Show OK/Cancel buttons on the picker |
| picker | Configuration for the date range picker dropdown |
See also
- DateField - Single date picker field
- PickerField - Base class for fields with dropdown pickers
Configs
Configs are options you supply in a configuration object when creating an instance of this class-
Max value
Has a corresponding runtime max property.
-
Min value
Has a corresponding runtime min property.
-
Set to
trueto include time fields to allow the user to pick the time of day. When this config is set,keepTimeis no longer used. -
An optional extra CSS class to add to the picker container element.
Has a corresponding runtime pickerCls property.
-
The week start day in the picker, 0 meaning Sunday, 6 meaning Saturday. Uses localized value per default.
Properties
Properties are getters/setters or publicly accessible variables on this class-
Identifies an object as an instance of DateRangeField class, or subclass thereof.
-
An optional extra CSS class to add to the picker container element.
Has a corresponding pickerCls config.
-
Identifies an object as an instance of DateRangeField class, or subclass thereof.
CSS variables
CSS variables that can be set to adjust appearance| Name | Description |
|---|---|
| --b-date-range-field-gap | Gap between the start and end date fields |