From 7a1db7e62033ca0236d829ae3e60303875c85ce1 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Thu, 12 Apr 2018 14:44:00 +0200 Subject: [FIX] web: wrong day column title in arabic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In arabic, with the version localization of bootstrap we use the week starts on saturday. But the version of bootstrap-datetimepicker we use in 10.0 and saas-14 is 3.0.3 which only fully supports week starting on sunday and monday. Thus in arabic, the column title in the date picker would be: Sunday <- Monday (ﻥ, ﺙ, ﺭ, ﺥ, ﺝ, ﺱ, ﺡ) Instead of what the numbered days in the calendar are shown as: Friday <- Saturday (ﺱ, ﺡ, ﻥ, ﺙ, ﺭ, ﺥ, ﺝ) This issue doesn't happen in saas-15, 11.0 and over since the library has been updated with ad6fd5f8 and the as of version 4 supports any starting day of week, with this change: https://github.com/Eonasdan/bootstrap-datetimepicker/commit/557b657 opw-1825640 closes #24200 --- .../src/js/bootstrap-datetimepicker.js | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'addons/web/static/lib/bootstrap-datetimepicker/src') diff --git a/addons/web/static/lib/bootstrap-datetimepicker/src/js/bootstrap-datetimepicker.js b/addons/web/static/lib/bootstrap-datetimepicker/src/js/bootstrap-datetimepicker.js index 8619c44a7d6..304845a0fee 100644 --- a/addons/web/static/lib/bootstrap-datetimepicker/src/js/bootstrap-datetimepicker.js +++ b/addons/web/static/lib/bootstrap-datetimepicker/src/js/bootstrap-datetimepicker.js @@ -391,18 +391,14 @@ THE SOFTWARE. if (picker.options.calendarWeeks === true) { html.append('#'); } - if (moment().localeData()._week.dow === 0) { // starts on Sunday - for (i = 0; i < 7; i++) { - html.append('' + weekdaysMin[i] + ''); - } - } else { - for (i = 1; i < 8; i++) { - if (i === 7) { - html.append('' + weekdaysMin[0] + ''); - } else { - html.append('' + weekdaysMin[i] + ''); - } - } + // ODOO change so week starting not on sunday/monday have correct + // day name. This is solved in saas-15 by using new library version + var startDay = moment().localeData()._week.dow; + if (startDay === undefined) { + startDay = 1; + } + for (i = startDay; i < startDay + 7; i++) { + html.append('' + weekdaysMin[i % 7] + ''); } picker.widget.find('.datepicker-days thead').append(html); }, -- cgit v1.2.3