An open API service indexing awesome lists of open source software.

https://github.com/faustienf/datepicker

📅 Make your DatePicker from calendar-components
https://github.com/faustienf/datepicker

datepicker daterange daterange-picker react react-date-picker react-date-range typescript

Last synced: about 1 month ago
JSON representation

📅 Make your DatePicker from calendar-components

Awesome Lists containing this project

README

          

[](https://faustienf.github.io/datepicker/?path=/story/datepicker-range--default)
# ⚛️ Modular DatePicker

Make your DatePicker from calendar-components 📅 [Demo](https://faustienf.github.io/datepicker/?path=/story/datepicker-range--default)

## Usage

#### Simple datepicker
```js
// write a facade-component
const DatepickerSimple: FC = (props) => {
const {
selected = 0 as Timestamp,
onSelect,
} = props;

// use hooks for manage states, e.g. switching a month
const {
currentMonthTimestamp,
onPrevMonth,
onNextMonth,
} = useCalendarMonth(selected || Date.now() as Timestamp);

return (

{(dayTimestamp) => (
onSelect(dayTimestamp)}
>
{/* display a date */}
{(new Date(dayTimestamp)).getDate()}

)}

);
};
```

#### Datepicker with 2 calendars
```js
const BigDatepicker: FC = () => {
...

return (
<>
{/* 1st calendar */}

...

{/* 2nd calendar */}

...

>
);
};
```

## License
MIT