Datepicker is used in a combination with UI-related Calendar that is initialized on clicking the control. It allows choosing a date and, optionally, time in the calendar for their further usage.
Related sample: Date Picker ('datepicker')
To initialize DatePicker on a page, make use of the code below:
{
view: "datepicker",
value: new Date(2017,10,9),
label: "Select Date",
timepicker: true
}
The Datepicker widget provides the possibility to select multiple dates in a calendar at once. To enable this feature, set the multiselect property to true:
webix.ui({
view:"datepicker",
value:"2016-1-14, 2016-1-16, 2016-1-18",
multiselect:true
});
To select several dates at a time, use the CTRL+mouse click combination.
The widget also supports multiple selection on touch devices. To enable this mode, you need to set the multiselect property to the "touch" value:
webix.ui({
view:"datepicker",
value:"2016-1-14, 2016-1-16, 2016-1-18",
multiselect:"touch",
stringResult:true
});
Related sample: Multiselect in the Calendar
Datepicker calendar can be shown in the month or year mode. To set one of these modes, use the type property with either "month" or "year" value:
webix.ui({
view:"toolbar",
elements:[
{view:"datepicker",align:"right",label:"Select Date",type:"month"}
]
});
webix.ui({
view:"toolbar",
elements:[
{view:"datepicker",align:"right",label:"Select Date",type:"year"}
]
});
If you need to select time (hours and minutes) only, use the datepicker with "time" type:
{ view:"datepicker",type:"time",stringResult:true }
Dates are formatted according to the Date Formatting Methods.
To limit the ability of a user to pick date and time periods, you should access the calendar object that lies in the datepicker popup and apply the needed configuration to it:
{
view:"datepicker",
suggest:{
type:"calendar",
body:{
minDate:new Date(),
maxDate:"2016-05-07"
}
}
}
More about Disabling Dates in Calendar
More about Advanced Popup Configuration in Popup Selectors
Back to top