mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-42587: calendar: Fix regression that stops dates autocorrecting
This commit is contained in:
parent
68291f2d57
commit
eed17976dc
1 changed files with 7 additions and 1 deletions
8
lib/form/yui/dateselector/dateselector.js
vendored
8
lib/form/yui/dateselector/dateselector.js
vendored
|
@ -137,10 +137,16 @@ YUI.add('moodle-form-dateselector', function(Y) {
|
|||
var year = parseInt(this.yearselect.get('value'));
|
||||
var month = parseInt(this.monthselect.get('value')) - 1;
|
||||
var day = parseInt(this.dayselect.get('value'));
|
||||
M.form.dateselector.calendar.select(new Date(year, month, day));
|
||||
var date = new Date(year, month, day);
|
||||
M.form.dateselector.calendar.select(date);
|
||||
M.form.dateselector.calendar.setMonth(month);
|
||||
M.form.dateselector.calendar.setYear(year);
|
||||
M.form.dateselector.calendar.render();
|
||||
if (date.getDate() != day) {
|
||||
// Must've selected the 29 to 31st of a month that doesn't have such dates.
|
||||
this.dayselect.set('value', date.getDate());
|
||||
this.monthselect.set('value', date.getMonth() + 1);
|
||||
}
|
||||
},
|
||||
set_selects_from_date : function(eventtype, args) {
|
||||
var date = args[0][0];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue