From e6021dbd97344ffdea8e7af3163664a19cb7e55a Mon Sep 17 00:00:00 2001 From: 2paperstar Date: Sun, 26 Nov 2023 12:48:04 +0900 Subject: [PATCH] fix: reflect changing of deadline date -> time --- src/app/components/molecules/DDay/DDay.tsx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/app/components/molecules/DDay/DDay.tsx b/src/app/components/molecules/DDay/DDay.tsx index ff2a5726..fb68f003 100644 --- a/src/app/components/molecules/DDay/DDay.tsx +++ b/src/app/components/molecules/DDay/DDay.tsx @@ -22,14 +22,11 @@ const DDay = ({ deadline, t, className }: PropsWithT) => ( ); const ddayFormatted = (deadline: dayjs.Dayjs, t: T) => { - const daysLeft = deadline - .tz() - .startOf('d') - .diff(dayjs.tz().startOf('d'), 'd'); + const daysLeft = deadline.diff(dayjs(), 'day', true); if (daysLeft < 0) return t('ddayPlus'); - if (daysLeft === 0) return 'D - Day'; - return `D - ${daysLeft}`; + if (daysLeft < 1) return 'D - Day'; + return `D - ${Math.floor(daysLeft)}`; }; export default DDay;