misc: add timeslots attributes when creating <option> (#67385)
This commit is contained in:
parent
5e922bcfc8
commit
f78c84c952
|
@ -34,17 +34,20 @@ $(function() {
|
|||
$select.empty();
|
||||
$('<option value=""></option>').appendTo($select);
|
||||
for (var i=0; i<items.length; i++) {
|
||||
var $option = $('<option></option>', {value: items[i].id, text: items[i].text});
|
||||
var date = new Date(items[i].datetime.slice(0, 10));
|
||||
var $option = $('<option></option>', {
|
||||
value: items[i].id,
|
||||
text: items[i].text,
|
||||
'data-weekday': WEEKDAYS[date.getDay()],
|
||||
'data-date': items[i].datetime.slice(0, 10),
|
||||
'data-time': items[i].datetime.slice(11, 16)
|
||||
});
|
||||
if (items[i].disabled) {
|
||||
$option.prop('disabled', true);
|
||||
}
|
||||
if (items[i].selected) {
|
||||
$option.attr('selected', true);
|
||||
}
|
||||
var date = new Date(items[i].datetime);
|
||||
$option.attr('data-weekday', WEEKDAYS[date.getDay()]);
|
||||
$option.attr('data-date', items[i].datetime.slice(0, 10));
|
||||
$option.attr('data-time', items[i].datetime.slice(11, 16));
|
||||
$option.appendTo($select);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue