-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
datepicker: add yearRangeReverse property sort year in reverse order #6521
base: v1-dev
Are you sure you want to change the base?
Conversation
js/datepicker.js
Outdated
} | ||
} | ||
arr = arr.concat(opts.yearRangeReverse ? years.reverse() : years); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why arr.concat is used here. You can probably leave the old code untouched and use one line with this:
if(opts.yearRangeReverse) {
arr.reverse();
}
Which will reverse the array elements in place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might also want to add it as default at the top.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DanielRuf I fixed the overhead.
Pls. what do you mean by add it as default at the top
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See https://github.com/Dogfalo/materialize/blob/v1-dev/js/datepicker.js#L4, the defaults are readable and visible when you output a component instance on the console.
Merged at materializecss@5a4c33c (includes the original commits at https://github.com/materializecss/materialize/commits/v1-dev). |
This add yearRangeReverse property to date picker to sort year range in reverse order
Types of changes
Checklist: