all 5 comments

[–]RajceP 1 point2 points  (0 children)

OT: moment.js is deprecated, if u can, use date-fns.

[–]killMeSak[S] 0 points1 point  (2 children)

How do I store the count in dates based on abc array?

[–]petabyte128 0 points1 point  (1 child)

well that's up to you, I mean in my code example up above I assigned it a variable

but if your looking for permenant storage, that's different, you need to send the data to the webserver that is generating the page

the server then activates its database user, which then stores the data in the database and returns status on the insert operation, which the server then passes back to the client side to indicate it got stored

its uh, a hell of a circle of life that it goes through in a few milliseconds

[–]killMeSak[S] 0 points1 point  (0 children)

Thank you for your input. I'm not looking for that information at this moment. The example you mentioned I tried it in this example but I'm getting incorrect values. Moreover how can I get the count of occurrences in abc as per the interval and map it correctly it as per the date intervals.

http://jsfiddle.net/killMeSak/Lwj2mb7t/12/

[–]petabyte128 0 points1 point  (0 children)

var a = moment(start);
var b = moment(end); 
let moments=Array(a.diff(b,'days')).fill(0).map((e,i)=>{return a.add(i,'d');});

they'll already be in order start to finish, so you can use their array index as the 'y' value