diff --git a/src/components/Post/Post.tsx b/src/components/Post/Post.tsx index a2def8d..2f1015b 100644 --- a/src/components/Post/Post.tsx +++ b/src/components/Post/Post.tsx @@ -29,7 +29,7 @@ export default function Post({ closed, }: PostProps) { const timeRange = formatTimeRange(startsAt, workhour); - const isPast = isPastDate(startsAt, workhour); + const isPast = isPastDate(startsAt); const isDimmed = closed || isPast; const { displayRate, rateText } = getPayRateText( hourlyPay, @@ -40,58 +40,58 @@ export default function Post({
{name} { e.currentTarget.onerror = null; e.currentTarget.src = "/default-image.png"; }} /> {isDimmed && ( -

+

{closed ? "마감 완료" : "지난 공고"}

)}
-
-

{name}

-

-

+

{name}

+

+

-

- +

+ {address1}

-
-

+
+

{hourlyPay.toLocaleString()}원

= 50 - ? "md:bg-red-40" + ? "sm:bg-red-40" : displayRate >= 25 - ? "md:bg-red-30" - : "md:bg-red-20", + ? "sm:bg-red-30" + : "sm:bg-red-20", displayRate > 0 ? "" : "opacity-0", )} > {rateText} - - + +

diff --git a/src/utils/datetime.ts b/src/utils/datetime.ts index 6b11d76..ad2b97b 100644 --- a/src/utils/datetime.ts +++ b/src/utils/datetime.ts @@ -50,10 +50,11 @@ export function formatTimeRange(startsAt: string, workhour: number): string { * @param startsAt - ISO 8601 형식의 날짜 문자열 * @param workhour - 근무 시간 (시간 단위) */ -export function isPastDate(startsAt: string, workhour: number): boolean { - const start = new Date(startsAt); - const end = new Date(start.getTime() + workhour * ONE_HOUR_MS); - return end.getTime() < Date.now(); +export function isPastDate(startsAt: string): boolean { + const startMs = Date.parse(startsAt); + const nowMs = Date.now(); + + return startMs < nowMs; } export const getRelativeTimeFromNow = (input: string | Date): string => {