feat: dida365 sort and pubDate

This commit is contained in:
DIYgod
2020-12-21 20:30:45 +08:00
parent c5f8dd19c6
commit f476900595
+8 -6
View File
@@ -49,12 +49,14 @@ module.exports = async (ctx) => {
for (const habitId in checkins.checkins) {
const info = habitsList.find((item) => item.id === habitId);
list = list.concat(
checkins.checkins[habitId].map((checkin, index) => ({
title: `第${index + 1}天${info.name}打卡`,
pubDate: checkin.checkinTime,
link: `https://dida365.com/webapp/#q/all/habit/${checkin.habitId}`,
guid: checkin.id,
}))
checkins.checkins[habitId]
.sort((a, b) => a.checkinStamp - b.checkinStamp)
.map((checkin, index) => ({
title: `第${index + 1}天${info.name}打卡`,
pubDate: `${(checkin.checkinStamp + '').slice(0, 4)}-${(checkin.checkinStamp + '').slice(4, 6)}-${(checkin.checkinStamp + '').slice(6, 8)}`,
link: `https://dida365.com/webapp/#q/all/habit/${checkin.habitId}`,
guid: checkin.id,
}))
);
}