Im building a filter in node.js and i need to loop through months in a given daterange and get the first and last days of said month(我在node.js中构建了一个过滤器,我需要在给定的日期范围内循环浏览几个月,并获取所述月份的第一天和最后几天)
every attempt i make at this after the first few months the dates start getting off(在开始的几个月之后,我为此所做的每一次尝试都会开始)
Example of results looping through 1 year(结果循环1年的示例)
2019-01-01 2019-01-31
2019-02-01 2019-02-28
2019-03-01 2019-03-31
2019-03-31 2019-04-29
2019-04-30 2019-05-30
2019-05-31 2019-06-29
2019-06-30 2019-07-30
2019-07-31 2019-08-30
2019-08-31 2019-09-29
2019-09-30 2019-10-31
2019-11-01 2019-11-30
2019-12-01 2019-12-31
by the end it seems to get back the dates(到最后似乎又回到了日期)
Any ideas?(有任何想法吗?)
ask by Avi Teller translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…