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

[Feature Request] Date object or ISOString in value DatePicker and similars #4401

Open
rivaslive opened this issue Dec 19, 2024 · 1 comment

Comments

@rivaslive
Copy link

rivaslive commented Dec 19, 2024

Is your feature request related to a problem? Please describe.

None

Describe the solution you'd like

As a user I want to have the facility to be able to have clean and easy to use pickers, currently it is too much code and complicated to try to make controlled DatePickers so that as a user I would expect the value to be a Date object or an ISOString just like the onChange should be the same, Additionally, it must have a format prop to format the fields in the input and output for that date. But currently we have import { parseDate } from '@internationalized/date'; in between that very possibly for some devs that is good but for me it is a headache to have to be using it when my app is based on dayjs and I have to be juggling to be able to have a clean ISOString currently I do something like this:

<NextUIDatePicker
      value={value ? parseDate(dayjs(value).format('YYYY-MM-DD')) : null}
      onChange={(value) => {
        onChange?.(dayjs(value?.toDate?.(dayjs.tz.guess())).toISOString());
      }}
    />

But it is unnecessary for me to have to have a wrapper of a wrapper for that, I think they should get rid of @internationalized/date even if it is only for the user, internally it can work with it easily.

For the TZ it should be possible to accept it as an extra parameter

Describe alternatives you've considered

Like other component libraries, you can configure adapters to output @internationalized/date and return the configured adapter, for example an adapter for datejs, another for date-fns, etc. This way, the community could create the adapters they wanted based on their tastes. Although the first iteration for me should be as native as possible.

The bias of having to use @internationalized/date overshadows the beauty of this picker

Screenshots or Videos

No response

Copy link

linear bot commented Dec 19, 2024

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

1 participant