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] useCountdownTimer 서버 시간 오차 이슈 해결 #48

Merged
merged 3 commits into from
Oct 10, 2024

Conversation

haejinyun
Copy link
Collaborator

What is this PR? 🔍

Changes 📝

  • countdown에 들어갈 시간 요소를 마운트 시점 이후에 계산하여 넣는 방향으로 수정하였습니다.
  • countdown을 하는 로직을 hook에서 분리해내고 util 쪽으로 이동하였습니다.
  • 마운트 이후 시전에서 countdown을 진행하기에 초기에 시간이 바로 보이지 않습니다. 따라서 '-'로 표시하고 이후에 타이머가 on 되도록 하였습니다.

ScreenShot 📷

tttt

Precaution

✔️ Please check if the PR fulfills these requirements

  • It's submitted to the correct branch, not the develop branch unconditionally?
  • If on a hotfix branch, ensure it targets main?
  • There are no warning message when you run npm run lint

@haejinyun haejinyun self-assigned this Oct 10, 2024
@haejinyun haejinyun added 🐞 BugFix Something isn't working 🔨 Refactor 코드 리팩토링 labels Oct 10, 2024
Copy link
Collaborator

@kimeodml kimeodml left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다~

Comment on lines +37 to +40
const day = Math.floor(remainingTime / DAY_IN_MILLIS) || '-';
const hour = Math.floor((remainingTime % DAY_IN_MILLIS) / HOUR_IN_MILLIS) || '-';
const minute = Math.floor((remainingTime % HOUR_IN_MILLIS) / MINUTE_IN_MILLIS) || '-';
const second = Math.floor((remainingTime % MINUTE_IN_MILLIS) / 1000) || '-';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

새로고침 시에 -일 -시간 -분- 초로 뜨는 부분은 나중에 디테일 챙길 때 UI 변경하는 걸로 합시다~

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

네엥!!@

@haejinyun haejinyun merged commit f207280 into develop Oct 10, 2024
1 check passed
@haejinyun haejinyun deleted the fix/#42 branch October 10, 2024 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 BugFix Something isn't working 🔨 Refactor 코드 리팩토링
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEAT] 타이머 서버 시간과 다름 이슈
2 participants