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

[pickers] Support timezone (and UTC) on AdapterDateFns #10573

Open
vu-dao-93 opened this issue Oct 4, 2023 · 6 comments
Open

[pickers] Support timezone (and UTC) on AdapterDateFns #10573

vu-dao-93 opened this issue Oct 4, 2023 · 6 comments
Labels
component: pickers This is the name of the generic UI component, not the React module! time-zone Issues about time zone management waiting for 👍 Waiting for upvotes

Comments

@vu-dao-93
Copy link
Contributor

vu-dao-93 commented Oct 4, 2023

Summary 💡

We use date-fns as our date library, and just realized that the timezone prop only supports DayJs, Luxon & Moment. We have tried some workarounds, but the efforts seem like re-inventing the component. Could you make the timezone prop works for DateFns? What are the steps & challenges to make that happens?

Examples 🌈

<LocalizationProvider dateAdapter={AdapterDateFns}>
  <DateTimePicker timezone="UTC" />
</LocalizationProvider>

Motivation 🔦

No response

Search keywords: timezones date-fns datefns UTC

@vu-dao-93 vu-dao-93 added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Oct 4, 2023
@zannager zannager added the component: pickers This is the name of the generic UI component, not the React module! label Oct 4, 2023
@alexfauquette alexfauquette added the time-zone Issues about time zone management label Oct 5, 2023
@alexfauquette
Copy link
Member

I kind of remind that the date-fns has not been added because of an issue. But I don't remember which one

@flaviendelangle is their a specific reason why date-fns has not be done or is it a lack of time?

@flaviendelangle
Copy link
Member

flaviendelangle commented Oct 25, 2023

Sorry for the delay, I missed the notification

Date FNS is using JavaScript Date object and you can't store a timezone on it (see this article)

There is a version of date-fns called date-fns-tz which adds support for timezone (NPM page).
But we need to see how it behaves exactly, because for me we won't be able to do things like adapter.getTimezone.

Basically it's just a question of priority for exploring what's doable.
But we have to keep in mind that we might hit a wall here.

@LukasTy LukasTy removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 22, 2023
@hutsul
Copy link

hutsul commented May 9, 2024

Hey there! Any news regarding this issue?

@LukasTy
Copy link
Member

LukasTy commented May 17, 2024

Hey there! Any news regarding this issue?

I appreciate your interest. 🙏
We are spread a bit too thin and have other priorities, so I can only confirm that we'll not be able to work on this issue before Q3. 😉
I've set the grooming priority for this issue to "Medium" so as not to lose it in the depths of other issues.

@flaviendelangle
Copy link
Member

date-fns@4 has new APIs for timezone support, this should make this issue doable: https://blog.date-fns.org/v40-with-time-zone-support/

I'm moving it back to "To grooming to discuss the priority

@flaviendelangle flaviendelangle changed the title [pickers] Support UTC dates and timezones for DateFns [pickers] Support timezone (and UTC) on AdapterDateFns Sep 17, 2024
@MrPoint1400
Copy link

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: pickers This is the name of the generic UI component, not the React module! time-zone Issues about time zone management waiting for 👍 Waiting for upvotes
Projects
None yet
Development

No branches or pull requests

7 participants