Skip to content

Commit

Permalink
Merge pull request #196 from gsainfoteam/reflect-change-of-deadline-d…
Browse files Browse the repository at this point in the history
…ate-to-time
  • Loading branch information
2paperstar authored Nov 26, 2023
2 parents 3da7341 + e6021db commit 202ae47
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/app/components/molecules/DDay/DDay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,11 @@ const DDay = ({ deadline, t, className }: PropsWithT<DDayProps>) => (
);

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;

0 comments on commit 202ae47

Please sign in to comment.