React-calendar: showNeighboringMonth = false doesn't seem to work when coupled with showDoubleView

Created on 2 Dec 2020  路  6Comments  路  Source: wojtekmaj/react-calendar

First of all, thanks for the great component you've made!

I was doing some testing with these parameters, and the showNeighboringMonth parameter works as intended:

      <Calendar
        minDate={new Date()}
        selectRange={true}
        showNeighboringMonth={false}
        locale={"es"}
      />

image

However when coupling with showDoubleView, it doesn't seem to work:

      <Calendar
        minDate={new Date()}
        selectRange={true}
        showDoubleView={true}
        showNeighboringMonth={false}
        locale={"es"}
      />

image

Am I doing something wrong on my end?

Edit: found a workaround, by adding a css rule:

.react-calendar__month-view__days__day--neighboringMonth {
  display: none;
}

Most helpful comment

Hi @LeoLozes

Your workaround is not totally right and caused this issue : https://github.com/wojtekmaj/react-calendar/issues/482

The correct workaround is :

.react-calendar__month-view__days__day--neighboringMonth {
  visibility: hidden;
}

Best regards

All 6 comments

Hi

I have the same issue as @LeoLozes

Thx for the workaround

Hi

The documentation explains well why showNeighboringMonth = false doesn't seem to work when coupled with showDoubleView.

showDoubleView = true forces showFixedNumberOfWeeks = true which forces showNeighboringMonth = true

Capture d鈥檈虂cran 2021-01-26 a虁 15 06 09

You are right!
However I don't really see why this is enforced since the calendar seems to work fine with the css rule applied, and I think is what makes most sense. You don't really want to see the next month in the first calendar when you have just besides it.

I'd say is how most of the biggest websites work (and it's why I need it to be that way as well):

AirBNB

Trivago

Momondo

Booking

Hi @LeoLozes

I'm totally agree with you.

Maybe the mainteners can explain why showNeighboringMonth is enforced to true when showDoubleView = true ?

Best regards !

@LeoLozes

BTW, have you encountered the issue explained here https://github.com/wojtekmaj/react-calendar/issues/339 with the DoubleView Calendar ?

If so, how have you solved the pb ?

Hi @LeoLozes

Your workaround is not totally right and caused this issue : https://github.com/wojtekmaj/react-calendar/issues/482

The correct workaround is :

.react-calendar__month-view__days__day--neighboringMonth {
  visibility: hidden;
}

Best regards

Was this page helpful?
0 / 5 - 0 ratings

Related issues

amansur picture amansur  路  6Comments

wojtekmaj picture wojtekmaj  路  5Comments

Coder2012 picture Coder2012  路  5Comments

olejorgenb picture olejorgenb  路  3Comments

dumkanki picture dumkanki  路  4Comments