Skip to content

Commit 0e060e1

Browse files
authored
Docs: fix DateField events example (#4402)
Docs Avoid error thrown when no date available to format:
1 parent b92f602 commit 0e060e1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/@react-spectrum/datepicker/docs/DateField.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ function Example() {
205205
return (
206206
<>
207207
<DateField label="Birth date" value={date} onChange={setDate} />
208-
<p>Selected date: {formatter.format(date.toDate(getLocalTimeZone()))}</p>
208+
<p>Selected date: {date ? formatter.format(date.toDate(getLocalTimeZone())): '--'}</p>
209209
</>
210210
);
211211
}

0 commit comments

Comments
 (0)