Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 날짜 비교 로직 수정 #224

Merged
merged 1 commit into from
Oct 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading