This question has been flagged
2 Replies
12320 Views

When I set my interface language to English, the first day of the week is sunday. The first day of the week is however, according to ISO, monday. I can change my interface language to e.g. French, German, or Spanish, but I prefer English. Is there any configuration option to set the correct week start day?

Avatar
Discard

this is very important question, please give us any answer for it if you can, also it will be really good if we can change the first day of the week easily through the calendar

Even with a French interface : The weeks in web calendar are starting on sunday !

I did change this behavior by editing /addons/web/static/lib/datejs/globalization/fr-FR.js and modify the line

firstDayOfWeek: 1,

by

firstDayOfWeek: 2,

I do not know if this is the "right" way. I would appreciate if someone has more info on this ?

Best Answer

Tekse was really close, and helped me find a good solution. Assuming you have a custom web module already up and running (which has to be named correctly, so go through the simple widget tutorial if this next part doesn't work on its own), all you need to do is make the change for both widget classes in "start" before you call super. The trick here is that widgets can extend themselves:

instance.web.DateTimeWidget = instance.web.DateTimeWidget.extend({
    start: function() {
        Date.CultureInfo.firstDayOfWeek = 1;
        this._super();
    },
});
instance.web.DateWidget = instance.web.DateWidget.extend({
    start: function() {
        Date.CultureInfo.firstDayOfWeek = 1;
        this._super();
    },
});

 

For some reason you need to apply this on DateTimeWidget and DateWidget, even though DateWidget inherits from DateTimeWidget. But this is what worked for me.

 

Avatar
Discard
Best Answer

I'm trying to make a module which changes this. I already made this:

openerp.change_firstdow = function(instance){
    var module = instance.web;

    module.Date.CultureInfo.firstDayOfWeek= 1;

};

but I think I'm missing something because it's not changes to Monday. Any help would be great! TArpi

Avatar
Discard