Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Angular ui-bootstrap datepicker day order

Currently the ui-bootstrap datepicker popup orders the days of the week Mon-Sun. I have a request from a customer to reorder them Sun-Sat

Interestingly, on the ui-bootstrap page, the inline example has the Sun-Mon order but the popup is Mon-Sun.

Is there a way to change the day order in the popup? I have not found any info on that topic in my googling.

like image 336
Andrew Avatar asked Sep 02 '25 02:09

Andrew


2 Answers

Andrew, in the Datepicker docs, under the "Popup Settings" subheading, it says "Options for datepicker can be passed as JSON using the datepicker-options attribute", which was the key piece for me in tackling the same problem you're facing.

See this JSFiddle, which simplifies the example code from angular-ui.github.io, and contains the bits I think you need. Note that you need to change to camel case "startingDay" spelling:

$scope.dateOptions = {
  formatYear: 'yy',
  showWeeks: false,      
  startingDay: 0
};
like image 111
dave_k_smith Avatar answered Sep 05 '25 00:09

dave_k_smith


That plugin has 'starting-day' as an option. Setting that to 0 will make it start on Sunday.

http://angular-ui.github.io/bootstrap/#/datepicker

like image 23
ribsies Avatar answered Sep 05 '25 00:09

ribsies