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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

"milliseconds" granularity for DateField and TimeField #6415

Open
andrei-zz opened this issue May 19, 2024 · 0 comments
Open

"milliseconds" granularity for DateField and TimeField #6415

andrei-zz opened this issue May 19, 2024 · 0 comments

Comments

@andrei-zz
Copy link

andrei-zz commented May 19, 2024

Provide a general summary of the feature here

TimeField and DateField should support "millisecond" granularity.

馃 Expected Behavior?

When passing granularity="millisecond" to <TimeField />, the TimeField should show a DateSegment that has current millisecond value and allow users to edit the millisecond value of the value prop.

馃槸 Current Behavior

The defined TypeScript type of the granularity prop doesn't even have "millisecond" option. (removed in #3435)

馃拋 Possible Solution

I'm not sure how DateField and TimeField work under the hood. I read useTimeField but still don't know how to implement the described functionalities by myself. Currently I render a separate NumberField to allow users to edit the millisecond field of the same value passed to TimeField (see "Examples" section). I.e.,

<NumberField
  label="Millisecond"
  value={myCalendarDateTimeValue.millisecond}
  onChange={(value) =>
    setMyCalendarDateTimeValue((prev) =>
      prev.set({ millisecond: value })
    )
  }
  minValue={0}
  maxValue={999}
/>

馃敠 Context

I am working on a time calculator project using combination of date and time input fields from 'react-aria-components'. The proposed feature is important for my project since I wanted to support millisecond level calculation. I saw #3117 and #3435, what are the challenges you faced in implementing the feature. I am willing to contribute but will need some guidance.

馃捇 Examples

Workaround described above
https://stackblitz.com/edit/vitejs-vite-ezvnrt?file=src%2FApp.tsx

馃Б Your Company/Team

No response

馃暦 Tracking Issue

No response

@andrei-zz andrei-zz changed the title "milliseconds" granularity for TimeField "milliseconds" granularity for DateField and TimeField May 26, 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