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

Limit maximum date to today in calendars #4746

Merged
merged 3 commits into from
Nov 4, 2024
Merged

Limit maximum date to today in calendars #4746

merged 3 commits into from
Nov 4, 2024

Conversation

apata
Copy link
Contributor

@apata apata commented Oct 28, 2024

Changes

Limits maximum date in calendars to today.

Tests

  • Tests added

Changelog

  • This PR does makes a user-facing change, but the change is very small

Documentation

  • This change does not need a documentation update

Dark mode

  • The UI has been tested both in dark and light mode

@ukutaht
Copy link
Contributor

ukutaht commented Oct 30, 2024

The design principle we've landed on is that everything in the dashboard should be scoped to the timezone of the site itself, ignoring the client's time zone completely. So we should be limiting the datepicker to "today" in the timezone that the site is configured.

With this implementation the "today" limit will change depending on the time zone I set my computer to. It's slightly confusing to me because toISOString should make it UTC but the calendar library is probably parsing it back in local timezone? Anyways, in this example I set my machine to NZ summer time (where "now" is 31st Oct) while the site stayed in Tallinn time (where "now" is 30 Oct). I would expect the date picker to limit to 30 Oct but it's 31st:

Screenshot 2024-10-31 at 00 10 17

Forcing it to "today" in UTC would also be wrong because not all sites are in UTC. I think the maxDate needs to take the timezone of the site into account somehow.

@apata
Copy link
Contributor Author

apata commented Nov 1, 2024

The design principle we've landed on is that everything in the dashboard should be scoped to the timezone of the site itself, ignoring the client's time zone completely. So we should be limiting the datepicker to "today" in the timezone that the site is configured.

Thanks for pointing it out, @ukutaht! It should be fixed now.

@apata apata added the preview label Nov 1, 2024
Copy link

github-actions bot commented Nov 1, 2024

Preview environment👷🏼‍♀️🏗️
PR-4746

@apata apata added this pull request to the merge queue Nov 4, 2024
Merged via the queue into master with commit bfa01bf Nov 4, 2024
12 checks passed
ruslandoga pushed a commit that referenced this pull request Jan 6, 2025
* Limit maximum date to today in calendars

* Add test

* Make calendar max dates sensitive to site timezone
ruslandoga pushed a commit that referenced this pull request Jan 6, 2025
* Limit maximum date to today in calendars

* Add test

* Make calendar max dates sensitive to site timezone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants