onefinestay / react-daterange-picker

Other
563 stars 209 forks source link

Start date is not highlighted when setting date range externally #222

Open vicacid opened 4 years ago

vicacid commented 4 years ago

The demo page contains example for the "Setting Calendar Range Externally" image

Pressing "Last 7 days" range is set from September 24, 2019 to October 1, 2019 but "24" is not highlighted in the component.

I assume first date of the range should be included to the visual selection.

vicacid commented 4 years ago

When setting in the component directly - everything is highlighted correctly for the same range. image

yuepywu commented 4 years ago

@vicacid

I have crosscheck their official demo source code (not sandbox one, and it's a bad example) and they have used moment startOf, below is a workable single date selection example using endOf:

value={moment.range(moment().startOf('day'), moment().endOf('day'))}