getmonths

It will return months as per given format between two dates

Usage no npm install needed!

<script type="module">
  import getmonths from 'https://cdn.skypack.dev/getmonths';
</script>

README

Using this package you can get all the months between two dates.

Example

startYear in YYYY format like 2018

endYear in YYYY format like 2018

startMonth in M format like 5

endMonth in M format like 8

monthArray like ["01","02","03","04","05","06","07","08","09","10","11","12"] or ["1","2","3","4","5","6","7","8","9","10","11","12"] or ["JAN","FEB"...] or ["January"...] or ["Jan"...]

Output will be : [05-2018, 06-2018, 07-2018, 08-2018] for first monthArray.

How to use in your code

  { 
      try {
          const startYear = 2018;
          const endYear = 2018;
          const startMonth = 2;
          const endMonth = 9;
          const monthArray = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"];
          console.log(test.getMonths(startYear, endYear, startMonth, endMonth, monthArray));
      } catch (error) {
          console.log(error);
      }
  }

abhishek2kr :cowboy_hat_face: