Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-42587: calendar: Fix regression that stops dates autocorrecting

  • Loading branch information...
commit eed17976dc9547fcdb8c1ef1115b1a85fb8dace6 1 parent 68291f2
@aolley aolley authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/form/yui/dateselector/dateselector.js
View
8 lib/form/yui/dateselector/dateselector.js
@@ -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];
Please sign in to comment.
Something went wrong with that request. Please try again.