digout
digout

Reputation: 4252

Flatpickr: don't display the first week of the following month

I don't want to show the first week of the following month in the calendar. Can not see anything in docs https://flatpickr.js.org/options/

enter image description here

Upvotes: 1

Views: 1133

Answers (2)

Anton Asplund
Anton Asplund

Reputation: 1

Important to know is that hiding the dates by either the visibility or display property will break keyboard navigation.

Upvotes: 0

digout
digout

Reputation: 4252

A bit of CSS jiggery pokery gets the results I need.

Hide the empty additional week into next month:

        .nextMonthDay {
            &:nth-last-child(-n+7) {
                display: none;
            }
        }

Hide all into next month:

        .nextMonthDay {
            display: none;
        }

Hide all from previous month (uses visibility instead of display to preserve alignment beneath day names:

        .prevMonthDay {
            visibility: hidden;
        }

Upvotes: 3

Related Questions