Skip to content

Add support for navigating with numberOfMonths #196

@ziadkh0

Description

@ziadkh0

I'm using this component with numberOfMonths = 4 and I need the navigation between months to be more like changing the page of months. E.g:

The visible months can be [1, 2, 3, 4] or [5, 6, 7, 8] or [9, 10, 11, 12]
So the visible months can never be [3, 4, 5, 6] for example.

I'm not setting the fromMonth and toMonth props so I can never run into the case where some of the months are not allowed.
But I understand that it can problematic.

One solution would be to only render the allowed months. E.g:
If the fromMonth = 2 and toMonth= 3 then we render [2, 3]
If the fromMonth = 2 and toMonth= 5 then we render [2, 3, 4], [5]

An other solution would be to say that the only change to the current behavior is that showNextMonth() and showPreviousMonth() will change the currentMonth by numberOfMonths instead of 1.

I would be happy to create a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions