2019-09-08 16:57:00 +00:00
|
|
|
# DatePicker
|
2019-08-23 12:23:22 +00:00
|
|
|
|
2019-11-20 11:21:14 +00:00
|
|
|
Base DatePicker component
|
2019-08-23 12:23:22 +00:00
|
|
|
|
2019-11-20 11:21:14 +00:00
|
|
|
### Usage
|
2019-08-23 12:23:22 +00:00
|
|
|
|
|
|
|
```js
|
2023-12-25 08:08:54 +00:00
|
|
|
import { DatePicker } from "@docspace/shared/components";
|
2019-11-20 11:21:14 +00:00
|
|
|
```
|
2019-09-08 16:57:00 +00:00
|
|
|
|
2019-11-20 11:21:14 +00:00
|
|
|
```jsx
|
2019-09-08 16:57:00 +00:00
|
|
|
<DatePicker
|
2020-10-16 13:16:01 +00:00
|
|
|
onChange={(date) => {
|
2019-09-11 10:46:21 +00:00
|
|
|
console.log("Selected date", date);
|
|
|
|
}}
|
2023-07-03 10:45:28 +00:00
|
|
|
date={new Date()}
|
2019-09-11 10:46:21 +00:00
|
|
|
minDate={new Date("1970/01/01")}
|
|
|
|
maxDate={new Date(new Date().getFullYear() + 1 + "/01/01")}
|
|
|
|
locale="en"
|
2019-11-20 11:21:14 +00:00
|
|
|
/>
|
2019-08-23 12:23:22 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
#### Properties
|
|
|
|
|
2023-07-14 15:12:31 +00:00
|
|
|
| Props | Type | Required | Values | Default | Description |
|
|
|
|
| ------------------ | ---------------- | :------: | ------ | ------------------------- | ------------------------------------------ |
|
|
|
|
| `selectDateText` | `string` | - | - | - | Select date text |
|
|
|
|
| `className` | `string` | - | - | - | Accepts class |
|
|
|
|
| `initialDate` | `date`, `string` | - | - | - | Default date |
|
|
|
|
| `id` | `string` | - | - | - | Accepts id |
|
|
|
|
| `locale` | `string` | - | - | `User's browser settings` | Browser locale |
|
|
|
|
| `maxDate` | `date`, `string` | - | - | - | Maximum date that the user can select. |
|
|
|
|
| `minDate` | `date`, `string` | - | - | - | Minimum date that the user can select. |
|
|
|
|
| `onChange` | `func` | - | - | - | Function called when the user select a day |
|
|
|
|
| `showCalendarIcon` | `bool` | - | - | - | Shows calendar icon in selected item |
|
|
|
|
| `outerDate` | `obj` | - | - | - | Allows to track date outside the component |
|
2023-07-18 11:24:15 +00:00
|
|
|
| `openDate` | `date`, `string` | - | - | - | Allows to set first shown date in calendar |
|