更改 Angular ui-bootstrap datepicker 日期顺序

问题描述:

目前,ui-bootstrap 日期选择器弹出窗口会订购周一至周日的星期几.客户要求我重新订购它们(周日至周六)

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

有趣的是,在 ui-bootstrap 页面上,内联示例具有 Sun-Mon 顺序,但弹出窗口是 Mon-Sun.

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.

Andrew,在 Datepickerdocs,在弹出设置"副标题下,它说可以使用 datepicker-options 属性将 datepicker 的选项作为 JSON 传递",这是我解决您面临的相同问题的关键部分.

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.

参见 this JSFiddle,它简化了来自 angular-ui.github.io 的示例代码,以及包含我认为你需要的位.请注意,您需要更改为驼峰式大小写startingDay"拼写:

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