Change Angular ui-bootstrap datepicker day order

こ雲淡風輕ζ 提交于 2019-12-09 19:39:49

问题


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.


回答1:


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
};



回答2:


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



来源:https://stackoverflow.com/questions/28286019/change-angular-ui-bootstrap-datepicker-day-order

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!