Get all months name from year in moment.js

后端 未结 9 910
执笔经年
执笔经年 2020-12-14 07:31

I want to get all months name from year in moment.js

if the year is 2011, then i want to all months name in momentjs

i have tried this below

9条回答
  •  失恋的感觉
    2020-12-14 08:08

    Using moment.js you have the following methods:

    moment.months() // long names
    

    returns:

    [ 'January',
      'February',
      'March',
      'April',
      'May',
      'June',
      'July',
      'August',
      'September',
      'October',
      'November',
      'December' ]
    

    and

    moment.monthsShort() // short names
    

    returns:

    ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
    

提交回复
热议问题