0

i am trying to split date in mongodb. For Example ,start date is 2020-07-01 & end date is 2020-07-05 , then , all date should be split in a sequence (i.e:- 2020-07-01,2020-07-02,2020-07-03,2020-07-04,2020-07-05) ?can anyone help me ?

2 Answers2

0

You can generate the date array in JS, Using MomentJS preferrably

Javascript - get array of dates between 2 dates

Pritam Mullick
  • 206
  • 3
  • 13
0

in js, you could

var start = new Date("2020-03-05");
var stop = new Date("2020-03-09");

for (d=start; d<=stop; d.setDate(d.getDate() + 1)) {
  console.log(d)
 }
mankowitz
  • 1,864
  • 1
  • 14
  • 32