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

后端 未结 3 1765
别那么骄傲
别那么骄傲 2021-02-12 21:14

I need to change the month names from short names to long names in my jQuery UI datepicker.

My properties are:

$.datepicker.regional[\'d         


        
相关标签:
3条回答
  • 2021-02-12 21:29

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

    0 讨论(0)
  • 2021-02-12 21:38

    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 ]
    
    0 讨论(0)
  • 2021-02-12 21:43

    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" ]
    
    0 讨论(0)
提交回复
热议问题