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

Start of Years #35

Closed
asharonbaltazar opened this issue Jul 31, 2023 · 5 comments
Closed

Start of Years #35

asharonbaltazar opened this issue Jul 31, 2023 · 5 comments

Comments

@asharonbaltazar
Copy link

Hello, and kudos to you for such a wonderful library 🚀.

I'm building a year dropdown that allows users to select a year. However, it only goes back to 2019. I'd like it to go back further than that. I know I can specify a number of years in the years property in useDatePicker, but that only works for the future. Any way to set a start year or something similar? Maybe it's adjusting the offset – I'm not sure how it works.

Thank you!

@Feshchenko
Copy link
Contributor

@asharonbaltazar, hey.
Not sure I got you.
Do you have a problem with next/previous years buttons?
Do you want to see more years on one page?

You can change the number of displayed years and mode, check in the Years Configuration doc.

    years: {
      numberOfYears: 30,
      mode: 'fluid'
    }

@asharonbaltazar
Copy link
Author

Thanks for replying. I'm mapping the years array, which is found as a property in the data object returned by useDatePicker. The earliest year in the list is 2019. I'd like it to go further back.

Does that make sense?

@asharonbaltazar
Copy link
Author

asharonbaltazar commented Jul 31, 2023

Ah, so if I understand correctly, I have to programmatically go back using previousYearsButton.

So then my question would be: Is there any way to map the years property as a list and avoid using the previousYearsButton?

@Feshchenko
Copy link
Contributor

Years have pagination. Number of years on one page defined by numberOfYears in the Years Configuration.
And you can change mode, for example, fluid will put a cursor in the middle.
If you want to go back, you have 2 options:

  • increase numberOfYears
  • use previousYearsButton and nextYearsButton to change the page

@Feshchenko
Copy link
Contributor

@asharonbaltazar , and you can check examples
You can fork and play with them

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

No branches or pull requests

2 participants