-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix: adjust start & end of event when system timezone is using DST #1222
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
Conversation
@@ -32,7 +32,7 @@ export function calculateTimezoneOffset(timezoneName: string, targetDate: TZDate | |||
'Intl.DateTimeFormat is not fully supported. So It will return the local timezone offset only.\nYou can use a polyfill to fix this issue.' | |||
); | |||
|
|||
return -targetDate.getTimezoneOffset(); | |||
return -targetDate.toDate().getTimezoneOffset(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TZDate
의 getTimezoneOffset
이 Date
의 getTimezoneOffset
과 약간 다른데, 이 때문에 문제가 제대로 해결되지 않고 있었습니다. 그래서 시스템의 타임존을 정확하게 꺼낼 필요가 있기 때문에 toDate
로 전환을 해 주었습니다.
@@ -170,6 +174,86 @@ DaylightSavingTimeTransitionSouthern.args = { | |||
}, | |||
}; | |||
|
|||
// NOTE: For manual testing purposes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
시스템의 타임존을 모킹하는 동작이 자동화된 테스트 환경에서는 어려웠기 때문에 직접 테스트용 페이지를 작성하여 확인했습니다.
@@ -17,6 +19,7 @@ export function useEventsWithTimezone(events: Collection<EventModel>) { | |||
return events; | |||
} | |||
|
|||
const isSystemUsingDST = isUsingDST(new TZDate()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isUsingDST
는 두 번째 인자로 타임존 이름을 넣지 않을 경우 현재 시스템을 기준으로 해당 시간의 DST 적용 여부를 결정합니다.
이를 통해 브라우저가 DST 적용중인지 아닌지 확인할 수도 있고, 어떤 이벤트가 시스템 타임존 기준으로는 DST 적용을 받고 있는지 아닌지 확인할 수 있습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
리뷰 완료합니다.
Please check if the PR fulfills these requirements
fix #xxx[,#xxx]
, where "xxx" is the issue number)Description
While rendering events, we need to calculate the offset difference if the system timezone is applicable to DST.
So we need to calculate it under the circumstance below:
Thank you for your contribution to TOAST UI product. 🎉 😘 ✨