jQuery UI datepicker: How to change the month names in the drop-down from short to long names?

房东的猫 提交于 2019-12-03 10:12:27
Bruno Arce Prado

Use the property monthNamesShort and attribute it the names you want.

In my case, I wanted to show, in the month drop-down, the month long name, in portuguese:

monthNamesShort: [ "Janeiro", "Fevereiro", "Março", "Abril",
                   "Maio", "Junho", "Julho", "Agosto", "Setembro",
                   "Outubro", "Novembro", "Dezembro" ]

It's not possible at the moment. See https://github.com/jquery/jquery-ui/pull/590 for details.

In many places they use the dateFormat to determine which list to use. Unfortunately in this block of code they weren't consistent using it. I made an adjustment to follow their method in _generateMonthYearHeader (around line 8985):

replace

  monthNamesShort[ month ]

with

 (inst.settings.dateFormat.match(/MM/) ? monthNames : monthNamesShort)[ month ]
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!