[FIX] web: _getFullCalendarOptions firstDay key
After making improvement to allow user to choose first day of week per language, it was not taken into account that calendar view uses different weekdays indexing than newly added field `week_start`. The difference is in Sunday, where in calendar view it has index 0, but week_start index is 7 (other days' indexes match). opw 1916666 closes odoo/odoo#29471
This commit is contained in:
@@ -385,6 +385,9 @@ return AbstractModel.extend({
|
||||
* @returns {Object}
|
||||
*/
|
||||
_getFullCalendarOptions: function () {
|
||||
var week_start = _t.database.parameters.week_start || 0;
|
||||
// calendar uses index 0 for Sunday but Odoo stores it as 7
|
||||
week_start = week_start % 7;
|
||||
return {
|
||||
defaultView: (this.mode === "month")? "month" : ((this.mode === "week")? "agendaWeek" : ((this.mode === "day")? "agendaDay" : "agendaWeek")),
|
||||
header: false,
|
||||
@@ -404,7 +407,7 @@ return AbstractModel.extend({
|
||||
monthNamesShort: moment.monthsShort(),
|
||||
dayNames: moment.weekdays(),
|
||||
dayNamesShort: moment.weekdaysShort(),
|
||||
firstDay: _t.database.parameters.week_start,
|
||||
firstDay: week_start,
|
||||
slotLabelFormat: _t.database.parameters.time_format.search("%H") != -1 ? 'H:mm': 'h(:mm)a',
|
||||
};
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user