Skip to content

Commit

Permalink
fix: Fix slope update date
Browse files Browse the repository at this point in the history
  • Loading branch information
Najeong-Kim committed Aug 22, 2024
1 parent 07412b3 commit 6e11372
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/widgets/header/lib/getFormattedYesterday.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export const getFormattedYesterday = () => {
const today = new Date();

const yesterday = new Date(today);
yesterday.setDate(today.getDate() - 1);

const month = yesterday.getMonth() + 1;
const day = yesterday.getDate();

return `${month}${day}일`;
};
3 changes: 2 additions & 1 deletion src/widgets/header/ui/slop-status-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import CircleInfo from '@/shared/icons/circle-info';
import { cn } from '@/shared/lib';
import { Tooltip } from '@/shared/ui/tooltip';
import { getFormattedYesterday } from '../lib/getFormattedYesterday';

const SlopStatusHeader = () => {
return (
Expand All @@ -19,7 +20,7 @@ const SlopStatusHeader = () => {
<p className={cn('body3-medium')}>매일 스키장 홈페이지에 고지된 정보를 가져와요.</p>
</Tooltip>
</div>
<p className={cn('body1-medium text-gray-50')}>10월 21일 23:00 업데이트</p>
<p className={cn('body1-medium text-gray-50')}>{getFormattedYesterday()} 23:00 업데이트</p>
</div>
);
};
Expand Down

0 comments on commit 6e11372

Please sign in to comment.