How to loop through months in Javascript

后端 未结 3 459
温柔的废话
温柔的废话 2021-01-12 15:02

I\'m trying to generate a list of string dates in months (i.e. [\"Oct 2014\", \"Nov 2014\",... \"Jan 2015\" ]) using the code here:

var resultList = [];
v         


        
3条回答
  •  不思量自难忘°
    2021-01-12 15:09

    Lets do it using Moment :

    moment(sd).add(1,'month').format("MMM-YY")
    

    You can find a difference between two dates

    moment("08-31-2017").diff(moment("01-31-2017"), 'months', true)
    

提交回复
热议问题