fix: incorrect date parsing (#1527)

* fix: incorrect date parsing

* fix eslint
This commit is contained in:
Zeng1998 2023-04-15 00:54:48 +08:00 committed by GitHub
parent d0c40490a7
commit 5652bb76d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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>