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

UI: rearrange logic for adding timezone in date-format helper #26693

Merged
merged 5 commits into from
Apr 30, 2024

Conversation

hellobontempo
Copy link
Contributor

@hellobontempo hellobontempo commented Apr 30, 2024

I was unable to reproduce this issue. I downloaded Brave and set my system timezone to GMT+1. I was not able to download the older version of Brave, but at least on newer versions this is no longer an issue. I updated the logic regardless so undefined timezones won't be displayed
image

@hellobontempo hellobontempo added this to the 1.17.0-rc milestone Apr 30, 2024
@hellobontempo hellobontempo requested a review from a team as a code owner April 30, 2024 12:40
@github-actions github-actions bot added the hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed label Apr 30, 2024
Copy link

github-actions bot commented Apr 30, 2024

Build Results:
All builds succeeded! ✅

Copy link

github-actions bot commented Apr 30, 2024

CI Results:
All Go tests succeeded! ✅

let zone; // local timezone ex: 'PST'
try {
// passing undefined means default to the browser's locale
zone = ' ' + date.toLocaleTimeString(undefined, { timeZoneName: 'short' }).split(' ')[2];
Copy link
Contributor Author

@hellobontempo hellobontempo Apr 30, 2024

Choose a reason for hiding this comment

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

removed the space here so if toLocaleTimeString doesn't error but returns undefined again in the future for some reason, zone will be falsey

Copy link
Contributor

@hashishaw hashishaw left a comment

Choose a reason for hiding this comment

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

Great! Just one suggestion to further strengthen the tests


const formatted = formatTimeZone(TEST_DATE);

assert.strictEqual(
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we add one more assertion, since the expected value is computed, that makes sure the zone is NOT undefined

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah! Good call ⚡

@hellobontempo
Copy link
Contributor Author

Screenshot 2024-04-30 at 4 30 38 PM

@hellobontempo hellobontempo merged commit b6beaab into main Apr 30, 2024
30 of 31 checks passed
@hellobontempo hellobontempo deleted the ui/VAULT-25450/fix-undefined-timezon branch April 30, 2024 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants