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

add timezone option to airdatepicker #648

Open
Unperterbed opened this issue Dec 21, 2023 · 2 comments
Open

add timezone option to airdatepicker #648

Unperterbed opened this issue Dec 21, 2023 · 2 comments

Comments

@Unperterbed
Copy link

It'd be great to set the timezone instead of it defaulting to UTC. In my case, I need to store the selected date/time in a variety of possible time zones, and the user is simply selecting the date/time according to their local time. To adjust the selected date/time value is rather arduous: I have to recognize their tz, modify the UTC output by the correct number of hours (while keeping it in UTC), and then convert it to their local time zone. For instance, a user in america/los_angeles may select a date of 2023-12-25. But when I convert the output directly to the pacific time zone it becomes 2023-12-24.

@pvictor
Copy link
Member

pvictor commented Aug 28, 2024

If you install from GitHub, there's now a tz = argument in airDatepickerInput() and updateAirDateInput(), let me know how it works for you if you test it.

@wmay
Copy link

wmay commented Oct 3, 2024

I tried this out and want to clarify--

  • the initial time is converted to the user's local time regardless of tz option
  • the tz option is only used to parse the datetime string returned from the picker

So that means it is impossible to set the initially selected time with this library, without knowing the user's timezone. I imagine this will be a problem for many apps that rely on time selection, unfortunately.

I see two ways to make this work:

  1. the local time zone conversion step in the browser is removed or made optional
  2. the returned datetime includes the user's timezone

Either of these options would allow an app author to get a consistent result from the picker regardless of user timezone.

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

No branches or pull requests

3 participants