Skip to content
This repository has been archived by the owner on Apr 13, 2022. It is now read-only.

Locale/option based first day of the week #32

Closed
enekochan opened this issue Sep 5, 2015 · 3 comments
Closed

Locale/option based first day of the week #32

enekochan opened this issue Sep 5, 2015 · 3 comments

Comments

@enekochan
Copy link

Right now the first day of the week is set to Sunday as it is used in en_US. But lots of languages, spanish for example, use other day, usually Monday, as first day of the week. We already have text and dates translations/localization which is great but this new feature I think should be a must.

I've tried myself coding this feature but failed. The only thing I've managed to change is the order of the days array (S, M, T, ...) based on moment().localeData().firstDayOfWeek() replacing this code in Calendar.prototype.calendarHTML:

$.each(this.days_array || moment.weekdaysMin(), function(i, elem) {
  ul_days_of_the_week.append('<li class="dr-day-of-week">' + elem + '</li>'); 
});

With this code:

var days = this.days_array || moment.weekdaysMin();
days = days.splice(moment().localeData().firstDayOfWeek()).concat(days.splice(0, moment().localeData().firstDayOfWeek()));
$.each(days, function(i, elem) {
  ul_days_of_the_week.append('<li class="dr-day-of-week">' + elem + '</li>'); 
});
@cissav
Copy link

cissav commented Jan 12, 2016

Any news on this one?

@kalepail
Copy link
Contributor

No not yet as we don't currently need this for Baremetrics. I also haven't heard much from other people needing this feature. I don't think it'd be super hard to do but it'd take some time to think through the best way. You'd definitely want it to be an option, though maybe a function option that doesn't automatically do anything until you explicitly tell it which day of the week it should start the week on.

@kalepail
Copy link
Contributor

kalepail commented Mar 7, 2016

@kalepail kalepail closed this as completed Mar 7, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants