更新时间:2022-05-24 22:32:45
要执行您要的操作,因为您已经拥有moment-range
,您将执行以下操作:
To do what you are asking since you already have moment-range
you would do something like this:
const range = moment.range(moment("2018-10-14"), moment("2018-10-20"));
console.log(Array.from(range.by('day')).map(x => x.format('YYYY-MM-DD')))
如果您不需要立即进行格式化,则只需:
If you do not need to format right away it would simply be:
Array.from(range.by('day')) // for your range
这是节点中的示例,但在您的情况下,该示例与之相似,只是导入
Here is an example in node but it would be similar in your case just import by