DatePicker on InteractiveServer render shows server's current day and not the user's when time zones differ
#10.241 geöffnet am 14.11.2024
Repository-Metriken
- Stars
- (10.394 Sterne)
- PR-Merge-Metriken
- (Durchschn. Merge 6T 6h) (108 gemergte PRs in 30 T)
Beschreibung
Things to check
- I have searched the existing issues for this bug
- To rule out a caching problem I made sure the bug also happens in an incognito tab
Bug type
Component
Component name
DatePicker
What happened?
Most servers have their time zone set to UTC. In InteractiveServer render mode, the date picker highlights the current day (today) as the server's current day, which can be different than the current day for the user.
Expected behavior
The highlighted "current day" (today) should match the user's timezone/day, not the server's in InteractiveServer render modes. If this not easily achievable via JS, perhaps a "Today" datetime property should be added so this can be set to user's datetime in code?
I believe the styling is set in the GetDayClasses() method where the following line use the injected TimeProvider for the current day...
if (day == TimeProvider.GetLocalNow().Date) return b.AddClass("mud-current mud-button-outlined").AddClass($"mud-button-outlined-{Color.ToDescriptionString()} mud-{Color.ToDescriptionString()}-text").Build();
Apologies if I missed how to correct for this in the documentation.
Reproduction link
Unable to reproduce, as I believe TryMudBlazor is WebAssemby?
Reproduction steps
- Create a DatePicker in an InterActive server application where the server has a different timezone than the user.
- User runs the application when their current day differs from the server's current day.
- The DatePicker will have the server's day outlined in the calendar.
Relevant log output
No response
Version (bug)
7.15
Version (working)
?
What browsers are you seeing the problem on?
Firefox, Chrome, Edge
On which operating systems are you experiencing the issue?
Windows
Pull Request
- I would like to do a Pull Request
Code of Conduct
- I agree to follow this project's Code of Conduct