You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am unaware of any easier way of changing the value of a DOM element in an Astro component, which does not seem elegant nor safe.
Reactive component?
Another way to solve this issue would be to port this component into a Preact component. But this might be overkill as it is only a single variable which is changed only at the first load.
The text was updated successfully, but these errors were encountered:
The way this currently works is that you take the current DateTime at the time of the request, like so:

https://github.com/TheoBr/faster-round/blob/a13b9a0ca4c4a76ba761f060d3d6326fb6a6c3ff/src/pages/results.astro#L7
And this is how it is rendered:
https://github.com/TheoBr/faster-round/blob/a13b9a0ca4c4a76ba761f060d3d6326fb6a6c3ff/src/pages/results.astro#L63-L64
But this bit of js is also executed on the server so it prints the local DateTime as if the user is in the same timezone as the server on which the code is executing.
This results in the following being rendered:
As you can see, the rendered time is off by two hours. I'm located in UTC+2 timezone, while the server is either running at UTC+0 timezone, or the actual closest edge (assuming this is rendered on the edge) is in that timezone.
Fix
I am not quite sure how you would solve this in an Astro component.
You could perhaps do something like this:
I am unaware of any easier way of changing the value of a DOM element in an Astro component, which does not seem elegant nor safe.
Reactive component?
Another way to solve this issue would be to port this component into a Preact component. But this might be overkill as it is only a single variable which is changed only at the first load.
The text was updated successfully, but these errors were encountered: