hoàn thành tích hợp FSRS

This commit is contained in:
2026-04-26 19:31:29 +07:00
parent a573acedd0
commit 8459801ca9
33 changed files with 997 additions and 185 deletions
+15
View File
@@ -0,0 +1,15 @@
const { format, isToday, isYesterday } = require("date-fns");
function formattedDate(date) {
if (isToday(date)) {
return "Today, " + format(date, "h:mma");
} else if (isYesterday(date)) {
return "Yesterday, " + format(date, "h:mma");
} else {
return format(date, "MMM dd, yyyy, h:mma");
}
}
const now = new Date();
const d1 = new Date(now.getTime() + 0.4025 * 24 * 60 * 60 * 1000);
const d2 = new Date(now.getTime() + 1.4612 * 24 * 60 * 60 * 1000);
console.log("Again:", formattedDate(d1));
console.log("Hard:", formattedDate(d2));