Skip to content

Commit

Permalink
Merge pull request #224 from INtiful/fix/homin/KAN-137-filtering-cancel
Browse files Browse the repository at this point in the history
fix: 날짜 비교 로직 수정
  • Loading branch information
HMRyu authored Oct 18, 2024
2 parents 8786a13 + 06019e7 commit 40dd009
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
const getDaysUntilRegistrationEnd = (registrationEnd: string) => {
const today = new Date();
const endDate = new Date(registrationEnd);
const today = new Date().setHours(0, 0, 0, 0); // 오늘의 날짜 (시간 0으로 설정)
const endDate = new Date(registrationEnd).setHours(0, 0, 0, 0); // 종료 날짜 (시간 0으로 설정)

// 두 날짜의 차이를 밀리초로 계산
const timeDifference = endDate.getTime() - today.getTime();

// 밀리초를 일 수로 변환 (하루 = 24 * 60 * 60 * 1000)
const daysRemaining = Math.ceil(timeDifference / (1000 * 60 * 60 * 24));
// 날짜 차이를 밀리초로 계산하고 일 수로 변환
const daysRemaining = (endDate - today) / (1000 * 60 * 60 * 24);

return daysRemaining;
};
Expand Down

0 comments on commit 40dd009

Please sign in to comment.