Skip to content

Commit

Permalink
hotfix demo not working
Browse files Browse the repository at this point in the history
  • Loading branch information
kamyar committed Jun 10, 2021
1 parent d43dc01 commit 3a6ca4e
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/components/DateRangePicker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,25 +91,25 @@ const [state, setState] = useState({
import { addDays } from 'date-fns';
import { useState } from 'react';

const [state, setState] = useState([
{
const [state, setState] = useState({
selection1: {
startDate: addDays(new Date(), -6),
endDate: new Date(),
key: 'selection1'
},
{
selection2: {
startDate: addDays(new Date(), 1),
endDate: addDays(new Date(), 7),
key: 'selection2'
}
]);
});

<DateRangePicker
onChange={item => setState([item.selection])}
onChange={item => setState({ ...state, ...item })}
showSelectionPreview={true}
moveRangeOnFirstSelection={false}
months={2}
ranges={state}
ranges={[state.selection1, state.selection2]}
direction="horizontal"
ariaLabels={{
dateInput: {
Expand All @@ -131,18 +131,18 @@ Show orange dot only for weekend
import { addDays, format, isWeekend } from 'date-fns';
import { useState } from 'react';

const [state, setState] = useState([
{
const [state, setState] = useState({
selection1: {
startDate: addDays(new Date(), -6),
endDate: new Date(),
key: 'selection1'
},
{
selection2: {
startDate: addDays(new Date(), 1),
endDate: addDays(new Date(), 7),
key: 'selection2'
}
]);
});

function customDayContent(day) {
extraDot = null;
Expand Down Expand Up @@ -170,11 +170,11 @@ function customDayContent(day) {
}

<DateRangePicker
onChange={item => setState([item.selection])}
onChange={item => setState({ ...state, ...item })}
showSelectionPreview={true}
moveRangeOnFirstSelection={false}
months={2}
ranges={state}
ranges={[state.selection1, state.selection2]}
direction="horizontal"
dayContentRenderer={customDayContent}
ariaLabels={{
Expand Down

0 comments on commit 3a6ca4e

Please sign in to comment.