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

Observe time zone name attribute #148

Merged
merged 3 commits into from
May 7, 2021
Merged

Conversation

koddsson
Copy link
Contributor

@koddsson koddsson commented May 6, 2021

Changing the time-zone-name attribute does not trigger a re-render of the <local-time> component. This behavior is a bug that I'm fixing in this pull request by adding time-zone-name to the list of observed attributes in ExtendedTimeElement.

Note that to get the attributeChangedCallback() callback to fire when an attribute changes, you have to observe the attributes. This is done by specifying a static get observedAttributes() method inside custom element class - this should return an array containing the names of the attributes you want to observe.

https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements

To be able to test this change, we need to pin the timezone. I pinned it to Dubai time since it seems to me to be a well-supported timezone but not typical for systems to default to like GMT, UTC, or any American timezones.

References

StackOverflow - How to pin a timezone in Chrome

@koddsson koddsson requested a review from a team as a code owner May 6, 2021 09:03
@koddsson koddsson merged commit 14beada into main May 7, 2021
@koddsson koddsson deleted the observe-time-zone-name-attribute branch May 7, 2021 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants