-
Notifications
You must be signed in to change notification settings - Fork 20
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
Changes hour select to display only even hours #233
Conversation
$picker.on('cancel.daterangepicker', function () { | ||
$picker.val(''); | ||
$from.val(''); | ||
$to.val(''); | ||
}); | ||
} | ||
|
||
function hourselectOnlyEvenHour() { | ||
let allSelectHours = document.getElementsByClassName('hourselect'); |
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 should use a jQuery selector and look for this item only in the current datepicker
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.
e.g.:
function hourselectOnlyEvenHour($picker) {
const allSelectHours = $picker.find('.hourselect');
}
$picker.on('cancel.daterangepicker', function () { | ||
$picker.val(''); | ||
$from.val(''); | ||
$to.val(''); | ||
}); | ||
} | ||
|
||
function hourselectOnlyEvenHour() { | ||
let allSelectHours = document.getElementsByClassName('hourselect'); | ||
console.log(allSelectHours); |
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.
to remove
Your select update is not persisted: if you select an hour in the first time select, both are reset with previous even & odd values. It's mainly because they must be re-render in order to disable invalid time in the second one if you select something in the first one |
And you have forgotten to handle the previous selected values : try to define a search, then to open the selector. The previously chosen value should be selected |
You can find the widget source code there if you need it : https://github.com/dangrossman/daterangepicker/blob/master/daterangepicker.js |
PR ouverte directement sur daterangepicker : dangrossman/daterangepicker#2079 |
Closes #128
Un peu bourrin comme solution mais je n'ai pas réussit a utiliser l'option
hours
de DateTimeType de Sf et datepickerrange ne propose pas d'option pour cela.