MakingSense / moment-datepicker

[ABANDONED REPOSITORY] The best bootstrap datepicker!
Apache License 2.0
92 stars 64 forks source link

Honor the first day of week setting of the current culture #37

Open otto-gebb opened 11 years ago

otto-gebb commented 11 years ago

When I set the moment.js language to ru, for instance, the first day of week in the datepicker is Sunday, although in the Russian locale it's Monday and this info is stored in the moment.js language settings. I think the datepicker should use these as the defaults.

otto-gebb commented 11 years ago

As a workaround I changed this line:

this.weekStart = options.weekStart || this.element.data('datepicker-weekstart') || 0;

to this:

this.weekStart = options.weekStart || this.element.data('datepicker-weekstart') || moment.fn._lang._week.dow;
andresmoschini commented 11 years ago

Nice, I will try to apply this change soon

otto-gebb commented 11 years ago

Well, I'm not sure this fix is the proper one, it clearly uses "private" properties, which are implementation details and are subject to change. I guess it's better to consult moment.js developers on how to properly get the thing via the public API. I couldn't find it in the documentation.