1
0
Fork 0

Fix error with zero posts

This commit is contained in:
Lim Chee Aun 2023-10-13 15:31:04 +08:00
parent 5481aa12be
commit cd403fe605

View file

@ -102,9 +102,12 @@ async function fetchPostingStats(accountID, masto) {
});
// Count days since last post
stats.daysSinceLastPost = Math.ceil(
(Date.now() - new Date(statuses[statuses.length - 1].createdAt)) / 86400000,
);
if (statuses.length) {
stats.daysSinceLastPost = Math.ceil(
(Date.now() - new Date(statuses[statuses.length - 1].createdAt)) /
86400000,
);
}
console.log('posting stats', stats);
return stats;