onefinestay / react-daterange-picker

Other
563 stars 208 forks source link

Option to disable half day range selection #157

Open msathis opened 7 years ago

msathis commented 7 years ago
screen shot 2016-09-20 at 3 30 03 pm

Is there a way to disable half day range selection? I want unavailable state to take full day and not allow half day selection.

divyabhargov commented 7 years ago

Do let us know if you solved this. We got an ugly workaround to pass UTC dates as moment ranges. This will color the whole dates.

oyaaraas commented 7 years ago

I need the same thing. Can you explain what you did for a workaround?

james-ff commented 6 years ago

+1 for this feature =]

sub commented 6 years ago

You can cherry-pick this commit from Pull Request #57. It works for me

james-ff commented 6 years ago

@sub Hi, how do we do that via npm? Many Thanks

sub commented 6 years ago

@james-ff actually it's not available via npm. However, npm can install dependencies via url like this

npm install github:user/repo

as explained here. So you can make your fork of this repo and cherry-pick the commit I linked before, or use (at your own risk) the branch integrations of my own fork.

Codypinto23 commented 5 years ago

I guess this won't work if you need to allow half-days for the "enquire" state, but if you're looking to just hide halfdays all together, I believe one solution is to alter the CSS so that the am and pm states overwrite the element-level background-color (assuming your default background color is white, in the code below):

  .DateRangePicker__CalendarDatePeriod--am {
      left: 0;
      background-color: white !important;
      right: 50%; }
    .DateRangePicker__CalendarDatePeriod--pm {
      left: 50%;
      background-color: white !important;
      right: 0; }

Note, this can cause some weird coloring issues if you color weekdays different from weekends image VS image