Skip to content

Commit 08757e1

Browse files
committed
resilient summary when dates are strings
1 parent f6ffa6d commit 08757e1

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎src/routes/projects/summary/index.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ router.route('/growth').get(
2929
const monthlyData = {};
3030

3131
projects.forEach(project => {
32-
const date = project.creationDate || project._id.getTimestamp();
32+
let date = project.creationDate || project._id.getTimestamp();
33+
if (typeof date === "string") date = new Date(date);
3334
const yearMonth = `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}`;
3435

3536
if (!monthlyData[yearMonth]) {

0 commit comments

Comments
 (0)