Created
December 11, 2015 06:01
-
-
Save christopherdro/be6036d45d9834d400b7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getDashboardCommentList = (comments) => { | |
return comments.reduce((previousValue, currentValue) => { | |
let commentDate = moment(currentValue.node.createdAt).startOf('day'); | |
if (previousValue.indexOf(commentDate.toDate().valueOf()) === -1) { | |
previousValue.push(commentDate.toDate().valueOf()); | |
} | |
return previousValue; | |
}, []) | |
.map((date) => { | |
return this.commentsForDay(new Date(date)); | |
});; | |
} | |
commentsForDay = (day) => { | |
return this.props.viewer.allAnnotations.edges.filter((comment) => { | |
let commentDate = new Date(comment.node.createdAt); | |
return commentDate.getMonth() == day.getMonth() && commentDate.getDay() == day.getDay() | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment