Need some help please. I am trying to group my click stats by week using underscore and moment.
here is the code:
var groupedByWeekFbCompleted = _.groupBy($scope.facebookObjects, function(item) {
return moment(item.timeclicked,"YYYY-MM-DD").isoWeek();
});
here is a screen shot of the chart it gives me

When I print groupedByWeekFbCompleted to the console this is what I get

The data comes from the DB formatted like this
2016-06-18 14:03:56
I can not figure out what 24, 26, 27, 28 and 29 represent. My hope is to display the first day of the week as a label and then group by that week
If you will take that date string and parse it using moment you will get something like
moment("2016-11-08 14:03:56", "YYYY-MM-DD HH:mm:ss").isoWeek()
// 45
24, 26, 27, 28 and 29 are the week day, and the values are arrays of dates within that week
EDIT
To display a date string on your labels, you can use the .format method to parse the timestamp you get from the moment function, provide it the same format you used, like so:
moment("2016-11-08 14:03:56", "YYYY-MM-DD HH:mm:ss").format("YYYY-MM-DD HH:mm:ss")
// output: "2016-11-08 14:03:56"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With