hoàn thành tích hợp FSRS
This commit is contained in:
@@ -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));
|
||||
Reference in New Issue
Block a user