Skip to content
This repository was archived by the owner on May 19, 2025. It is now read-only.

Commit e2c3d3d

Browse files
committed
Give the user more control over date display options
1 parent b32e6ab commit e2c3d3d

File tree

5 files changed

+240
-257
lines changed

5 files changed

+240
-257
lines changed

src/components/Calendar/README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
```jsx inside Markdown
44
import * as locales from 'react-date-range/dist/locale';
5+
import {useState} from 'react'
56

67
const nameMapper = {
78
ar: 'Arabic',
@@ -60,6 +61,9 @@ const localeOptions = Object.keys(locales)
6061
.filter(item => nameMapper[item.value]);
6162

6263
const [locale, setLocale] = React.useState('ja');
64+
const [date, setDate] = useState(null);
65+
66+
6367
<div style={{ display: 'flex', flexFlow: 'column nowrap' }}>
6468
<select
6569
style={{ margin: '20px auto' }}
@@ -72,6 +76,7 @@ const [locale, setLocale] = React.useState('ja');
7276
</option>
7377
))}
7478
</select>
75-
<Calendar locale={locales[locale]} date={null} />
79+
<Calendar onChange={item => setDate(item)}
80+
locale={locales[locale]} date={date} />
7681
</div>;
7782
```

0 commit comments

Comments
 (0)