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

Support for Temporal #466

Open
dmtrKovalenko opened this issue Sep 18, 2020 · 6 comments
Open

Support for Temporal #466

dmtrKovalenko opened this issue Sep 18, 2020 · 6 comments
Labels
enhancement New feature or request

Comments

@dmtrKovalenko
Copy link
Owner

Should we implement an adapter for the provided (for now experimental) proposal for Temporal? https://tc39.es/proposal-temporal/docs/parse-draft.html

@dmtrKovalenko dmtrKovalenko added the enhancement New feature or request label Oct 5, 2020
@dantman
Copy link
Contributor

dantman commented Jul 27, 2021

I would like to say yes, because date-io is used by libraries with separate DatePicker and TimePicker fields and it would be interesting to see those backed by Temporal.PlainDate and Temporal.PlainTime. However Temporal is pretty different from every other date library where only something equivalent to Temporal.Instant is used. I expect a new major with an updated API may be necessary to properly add Temporal.

@remy90
Copy link

remy90 commented Feb 9, 2022

Can anyone point me in the right direction for implementing getFormatHelperText for Temporal? I can see it spits out a date format but i'm not sure how to apply this in Temporal.ZonedDateTime's context.

I'm hacking my way through an implementation for IUtils<Temporal.ZonedDateTime> as I've noticed mui's datepicker conforms to date-io's IUtils interface for its localisation dateAdapter.

mui/mui-x#4399

@dmtrKovalenko
Copy link
Owner Author

@remy90 this likely will be complicated native into doesn't have this option so for Luxon we basically omit this feature. I suppose for temporal this will be the only solution as well

@remy90
Copy link

remy90 commented Feb 9, 2022

Thanks for your swift response, after moving past this step, i'm not sure it's currently possible to apply a date format to Temporal.TimeZone string out of the box anyway: https://github.com/js-temporal/proposal-temporal-v2#ability-to-parse-a-user-supplied-string-format-into-temporal-objects

@dantman
Copy link
Contributor

dantman commented Feb 26, 2022

Ok, I see two possibilities for a future date-io that supports Temporal.

  • A) A @date-io/temporal adapter that works like the current adapters so it's "compatible", but throws out most of the advantages of Temporal. i.e. The adapter only accepts Temporal.Instant and Temporal.ZonedDateTime. Anyone wanting to work with other types like Temporal.PlainDate is out of luck. And anyone hoping a date picker using @date-io as an adapter would let them pick Temporal.PlainDate instead of a full datetime is out of luck.
  • B) A new major @date-io with an updated Temporal-first API, where the temporal implementation is aware of things like Temporal.PlainDate and time zones. date() would be replaced with individual functions that are better aware of what is being parsed (a full timestamp, just the day of year, just the time?). And the other adapters use this API, with acknowledgement of course that there are limitations to what they can do.

@wobsoriano
Copy link

Yes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants