Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

previous and next year actions #8

Closed
tamazlykar opened this issue Jan 27, 2023 · 4 comments
Closed

previous and next year actions #8

tamazlykar opened this issue Jan 27, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@tamazlykar
Copy link
Contributor

Hi. I want to propose a new feature that will help to build different types of calendars.
In the dev app, you have the next setup:
Screenshot 2023-01-25 at 15 00 08
Previous and Next buttons in the day view are changing the current month by one.
Previous and Next buttons in the month view are changing the current month by one as well.
Previous and Next buttons in the year view are changing the current year by decades and do not update a current year.

I think there is also could be actions (prop getters) that will change the current year by one. This will be fit to the month view in the dev app.
The nextYearsButton with a step = 1 not works well in this case, because if I want to connect this button to a month view with the minDate / maxDate setting I got the wrong disabled state of the button.

In any case, the API of the library allows you to implement all this manually, but perhaps this will be in demand by other developers.

@Feshchenko
Copy link
Contributor

The role of next/previous month/year is to move offsetDate.
I have an idea to allow configuring a step of next/previous month's prop-getters so users could do things like this:
...nextMonth(month, { step: 12 }) - it will be equal to moving offsetDate 1 year to the future.
A good point is to expose offsetDate to help developers determine what offset is.
Also, as quick enhancement could be to accept offset in setNexMonth, setPreviousMonth actions.

@Feshchenko Feshchenko added the enhancement New feature or request label Feb 10, 2023
@Feshchenko
Copy link
Contributor

Feshchenko commented Feb 18, 2023

@tamazlykar, hello again. :)
I think that v4.3.0 will help to move 1 year back and forward.
Just pass { step: 12 } to the previousMonthButton and nextMonthButton and it is ready to go.

@tamazlykar
Copy link
Contributor Author

tamazlykar commented Feb 20, 2023

@Feshchenko, hello :)
Thank you so much. I tried and found some issue in behaviour.
I make some reproduction of the issue (this is your example with a configured step and minDate/maxDate).
To reproduce:

  1. select January
  2. See that the previous year button becomes disabled.
    The same issue will be if you choose any month in the previous year (except a current one - February).

@vikrrantshah
Copy link

vikrrantshah commented Jul 1, 2023

The role of next/previous month/year is to move offsetDate.
I have an idea to allow configuring a step of next/previous month's prop-getters so users could do things like this:
...nextMonth(month, { step: 12 }) - it will be equal to moving offsetDate 1 year to the future.
A good point is to expose offsetDate to help developers determine what offset is.
Also, as quick enhancement could be to accept offset in setNexMonth, setPreviousMonth actions.

@Feshchenko Thank you for you contributions. It would be nice if this information is more clearly stated in the repo documentation and would be much more appreciated if this is also updated in the code sandbox examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants