onefinestay / react-daterange-picker

Other
563 stars 209 forks source link

Range in a single day #226

Open andrewquartey opened 4 years ago

andrewquartey commented 4 years ago

I find that when I set singleDateRange to true. I am able to select a single day by double clicking. However the start and end date dates are both the same time (00:00) in that day.

Can it be made such that selecting the same day will change the range of the end date to 23:59? So that the range becomes. start: 00:00 and end:23:59

yuepywu commented 4 years ago

@andrewquartey you may try the following:

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

References:

https://momentjs.com/docs/#/manipulating/start-of/ moment().startOf('day'); // set to 12:00 am today

https://momentjs.com/docs/#/manipulating/end-of/ moment().endOf("year"); // set the moment to 12-31 23:59:59.999 this year