Skip to content
Discussion options

You must be logged in to vote

We support something like this in our Spectrum implementation. See https://react-spectrum.adobe.com/v3/DateField.html#help-text

It's implemented here:

export function useFormatHelpText(props: Pick<SpectrumDatePickerBase<any>, 'description' | 'showFormatHelpText'>): ReactNode {
let formatter = useDateFormatter({dateStyle: 'short'});
let displayNames = useDisplayNames();
return useMemo(() => {
if (props.description) {
return props.description;
}
if (props.showFormatHelpText) {
return (
formatter.formatToParts(new Date()).map((s, i) => {

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ty2k
Comment options

Answer selected by ty2k
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants