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

Changes hour select to display only even hours #233

Closed
wants to merge 1 commit into from

Conversation

Aurelie-feyzin
Copy link

@Aurelie-feyzin Aurelie-feyzin commented Apr 5, 2020

Closes #128

Un peu bourrin comme solution mais je n'ai pas réussit a utiliser l'option hoursde DateTimeType de Sf et datepickerrange ne propose pas d'option pour cela.

@mRoca mRoca changed the title Closes #128 changes hourselect to display only even hours Changes hour select to display only even hours Apr 5, 2020
$picker.on('cancel.daterangepicker', function () {
$picker.val('');
$from.val('');
$to.val('');
});
}

function hourselectOnlyEvenHour() {
let allSelectHours = document.getElementsByClassName('hourselect');
Copy link
Contributor

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

Copy link
Contributor

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to remove

@mRoca
Copy link
Contributor

mRoca commented Apr 5, 2020

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

@mRoca
Copy link
Contributor

mRoca commented Apr 5, 2020

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

@mRoca
Copy link
Contributor

mRoca commented Apr 5, 2020

You can find the widget source code there if you need it : https://github.com/dangrossman/daterangepicker/blob/master/daterangepicker.js

@Aurelie-feyzin
Copy link
Author

PR ouverte directement sur daterangepicker : dangrossman/daterangepicker#2079

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

Successfully merging this pull request may close these issues.

Only allow coherent periods in planning availability selector
2 participants