-
-
Notifications
You must be signed in to change notification settings - Fork 79
Fix: Timezone dropdown label does not account for DST #584
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
base: main
Are you sure you want to change the base?
Fix: Timezone dropdown label does not account for DST #584
Conversation
This implements a GMT offset string that is DST aware, and is prepended to the label value.
…s supported by most modern browsers, so should be safe.
Uses longOffset to simplify the regex match and code.
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.
@niranjan-uma-shankar before I dig too deep into this - could you add some tests for the new functions? Thanks!
packages/timezone-data/src/index.ts
Outdated
}; | ||
|
||
const labelWithGMTOffset = (label: string, offsetString: string): string => { | ||
return '(' + offsetString + ') ' + label; |
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.
nit: could use a template literal here to stay consistent with L308
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.
Makes sense, I've updated with this change.
…inutes (2) added a try/catch block for graceful failure
@troyciesco I've added tests now. |
Fixes TryGhost/Ghost#24559. The Admin facing changes are implemented in TryGhost/Ghost#24557, and needs to be deployed along with this PR.
Changes:
timezoneDataWithGMTOffset()
function dynamically prepends the GMT offset to the label, thereby ensuring that it respects DST.formatter.formatToParts()
.