Change Angular ui-bootstrap datepicker day order

2019-04-10 20:42发布

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.

2条回答
太酷不给撩
2楼-- · 2019-04-10 20:59

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
};
查看更多
聊天终结者
3楼-- · 2019-04-10 21:05

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

查看更多
登录 后发表回答