Replies: 1 comment
-
Thanks for the suggestion. I'm not sure what this component would do other than display a date or time. Perhaps you're looking for https://react-spectrum.adobe.com/react-spectrum/LabeledValue.html#labeledvalue which can already handle some date formatting https://react-spectrum.adobe.com/react-spectrum/LabeledValue.html#dates-and-times If there's no interactions, I don't think we need any aria/stately hooks for it, nor a React Aria Component either. Or you can use the browser native API's such as https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/format Note, if you need them look "Spectrum" you could pass the result into LabeledValue https://react-spectrum.adobe.com/react-spectrum/LabeledValue.html#components Let us know if you had something else in mind. |
Beta Was this translation helpful? Give feedback.
-
Hello React Spectrum Team,
I hope this message finds you well. I wanted to share a feature idea that I believe could enhance the React Spectrum library's capabilities.
Would it be possible to consider adding a Timestamp component (e.g., @react-spectrum/timestamp) to React Spectrum? This would display human-readable date and time with various formatting options and automatic updates.
Use Cases:
This component could be valuable in various scenarios, such as:
Usage Examples
`import { Timestamp } from '@react-spectrum/timestamp';
// Basic usage (auto variant, long format)
// Relative-only display
// Absolute display with time
`
This component would pair well with other date/time-related components in React Spectrum like DatePicker, enhancing the library's handling of temporal information.
Thank you for considering this feature request. I understand the React Spectrum team has many priorities, and I appreciate your time in reviewing this suggestion.
Beta Was this translation helpful? Give feedback.
All reactions