edwardfxiao / react-minimal-datetime-range

A react component for date time range picker. Online demo examples
https://edwardfxiao.github.io/react-minimal-datetime-range/
MIT License
16 stars 7 forks source link

Feature #8

Closed HarkiratShopism1 closed 11 months ago

HarkiratShopism1 commented 11 months ago

Hey brother,

your project "react-minimal-datetime-range" is very nicely done and I am using DateRangePicker component for one of my client and I want to know that is there any way I can automatically set an ending date when the start date gets selected by the user. harkirat.shopism@gmail.com this is my email please email me.

Thanks

edwardfxiao commented 11 months ago

Hi,

Thank you for your report, please try v2.0.8 see if it works, and can you also help me test everything else to make sure it does not break anything? Thanks


<RangePicker
 duration={2} // day count. default is 0. End date will be automatically added 2 days when the start date is picked.
  ...
/>
HarkiratShopism1 commented 11 months ago

Hi Bro,

Thank you for your response I will try it and surely will help you test out this feature. Please do let me know if there is any update to this.

HarkiratShopism1 commented 11 months ago

Hi,

duration is working fine but there's a bug. When I tried to click on to the start date 1st and 2nd time it haven't worked but worked at third click. It should work at first click. Whenever a start date is clicked the end date should automatically get selected as startDate + duration.

Thank you

edwardfxiao commented 11 months ago

What browser are you using? I cannot reproduce the problem. Can you provide a screen recording of the issue?

edwardfxiao commented 11 months ago

Right now, my plan works like this: the user provides a duration of 2, then selects the start date (let's say August 1), and an end date of August 3 will be automatically chosen. Finally, the user clicks 'confirm' to set the value.

Does this meet your requirements?

HarkiratShopism1 commented 11 months ago

My requirement goes like this Duration is preset to 28days OR the one you are planning the user will select the duration is also fine. Both work for me. User clicks and open the dateSelector User clicks on a date -> end date gets automatically selected. That is staryDate + duration(in Days) = endDate Something like this...

I am using edge and chrome both for testing and dev. Same issue on both.

Following is the link of the screen recordiing https://www.loom.com/share/ba10c7b0aa394f4b8d0f71a2d8ddaf42?sid=05088d58-8d15-429c-8340-b157355a6137

I can also show you live if you are available for a call.

edwardfxiao commented 11 months ago

Ok, I see the issue, let me debug

For now, is because you did not provide defaultDates

HarkiratShopism1 commented 11 months ago

Should I create a sandbox ?

edwardfxiao commented 11 months ago

No, I did a quick fix (try v2.0.9) for it, but please provide an empty array of defaultDates (defaultDates={[]} ) for now

<RangePicker
       ...
              placeholder={['Start Time', 'End Time']}
              defaultDates={[]}
              onConfirm={res => console.log(res, 1)}
              onClose={() => console.log('closed')}
              duration={2} // day count default is 0. End date will be automatically added 2 days when the start date is picked.
       ...
 />
HarkiratShopism1 commented 11 months ago

Ok alright will test and confirm

Thank you

HarkiratShopism1 commented 11 months ago

Hi Brother,

Its working fine as required.

Thank you for your time and help bro...