zpaulovics / datetimepicker-rails

A date and time picker for Twitter Bootstrap in Rails using Simple Form
MIT License
174 stars 80 forks source link

weekStart option #55

Closed Aelphy closed 9 years ago

Aelphy commented 9 years ago

There is no weekStart option.

zpaulovics commented 9 years ago

Hi,

You are right. The underlying Moment JS library's locale file contains the weekStart parameter. Have a look at the bootstrap-datetimepicker.xx.js file related to your locale (xx: your locale code). Below you can see a part of this locale file for hu:

    return moment.lang('hu', {
        months : "január_február_március_április_május_június_július_augusztus_szeptember_október_november_december".split("_"),
        monthsShort : "jan_feb_márc_ápr_máj_jún_júl_aug_szept_okt_nov_dec".split("_"),
        weekdays : "vasárnap_hétfő_kedd_szerda_csütörtök_péntek_szombat".split("_"),
        weekdaysShort : "vas_hét_kedd_sze_csüt_pén_szo".split("_"),
        weekdaysMin : "v_h_k_sze_cs_p_szo".split("_"),

   ...
        week : {
            dow : 1, // Monday is the first day of the week.
            doy : 7  // The week that contains Jan 1st is the first week of the year.
        }
    });

The "dow" parameter related to week start. You only need to set your choice of locale in your application and you will get the correct week start out of the box from the Moment JS.

Regards,

Zoltan