Materialize: datepicker selectYears should allow ranges or intervalls

Created on 16 May 2017  路  4Comments  路  Source: Dogfalo/materialize

If you want to use the datepicker with year selector, you do not need future years. When setting
selectYears: 100
it shows 50 years in the future and 50 years in the past. It would make more sense if you can set an intervall or set negative years like:
selectYears: -100
to show the last 100 years in the dropdown

Most helpful comment

Would be good if max: new Date() was in the docs.

All 4 comments

@domste it think you want to file this as issue in the pickadate repository as this is the behavior of pickadate.js http://amsul.ca/pickadate.js/date/#selectors

https://github.com/amsul/pickadate.js

you are right, I'm sorry.

I was just working with this.... here's what you do.

 $('.datepicker').pickadate({
    max: new Date(),
    selectMonths: true, // Creates a dropdown to control month
    selectYears: 100 // Creates a dropdown for 100 years (up to the max date you set)
});

This stops the date at the current date as the max. Then when you enter the years in 'selectYears' it will only go previous 100 years. (Or what ever number you put in)

At least it worked for me. Hope this helps.

Would be good if max: new Date() was in the docs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ReiiYuki picture ReiiYuki  路  3Comments

MickaelH974 picture MickaelH974  路  3Comments

locomain picture locomain  路  3Comments

artur99 picture artur99  路  3Comments

djensen47 picture djensen47  路  3Comments