Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

fix: incorrect date parsing (#1527)

Zeng19985652bb76d46a
diff --git a/web/src/pages/DailyReview.tsx b/web/src/pages/DailyReview.tsx
index 5f1e408c0..495998162 100644
--- a/web/src/pages/DailyReview.tsx
+++ b/web/src/pages/DailyReview.tsx
@@ -1,4 +1,3 @@
-import dayjs from "dayjs";
import { last } from "lodash-es";
import { useEffect, useRef, useState } from "react";
import toast from "react-hot-toast";
@@ -78,9 +77,6 @@ const DailyReview = () => {
toggleShowDatePicker(false);
};
- const currentMonth = dayjs().format("MMM");
- const currentDayOfWeek = dayjs().format("ddd");
-
return (
<section className="w-full max-w-2xl min-h-full flex flex-col justify-start items-center px-4 sm:px-2 sm:pt-4 pb-8 bg-zinc-100 dark:bg-zinc-800">
<MobileHeader showSearch={false} />
@@ -128,11 +124,11 @@ const DailyReview = () => {
<div className="mx-auto font-bold text-gray-600 dark:text-gray-300 text-center leading-6 mb-2">{currentDate.getFullYear()}</div>
<div className="flex flex-col justify-center items-center m-auto w-24 h-24 shadow rounded-3xl dark:bg-zinc-800">
<div className="text-center w-full leading-6 text-sm text-white bg-blue-700 rounded-t-3xl">
- {currentMonth[0].toUpperCase() + currentMonth.substring(1)}
+ {currentDate.toLocaleString("en-US", { month: "short" })}
</div>
<div className="text-black dark:text-white text-4xl font-medium leading-12">{currentDate.getDate()}</div>
<div className="dark:text-gray-300 text-center w-full leading-6 -mt-2 text-xs">
- {currentDayOfWeek[0].toUpperCase() + currentDayOfWeek.substring(1)}
+ {currentDate.toLocaleString("en-US", { weekday: "short" })}
</div>
</div>
</div>