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

Time picker output doesn't follow expected behaviour #247

Closed
sgerin opened this issue Oct 12, 2013 · 3 comments
Closed

Time picker output doesn't follow expected behaviour #247

sgerin opened this issue Oct 12, 2013 · 3 comments
Labels

Comments

@sgerin
Copy link

sgerin commented Oct 12, 2013

Hi,
I don't know what if I'm doing something wrong or it's the normal behaviour of pickadate.js but I can't get expected times to show up with a time picker.
Basically I want to display one picker with different values based on user input: it will show times from 5:40am to 22:20pm in one case and times from 6:00am to 22:40pm otherwise. I want to apply a 40 minutes interval in both cases.

My code is the following:

var $time_input;

if(direction == 0)
{
    $time_input = jQuery('.timepicker').pickatime({
    min: [5,40],
    max: [22,20],
    interval: 40,
    format: 'HH:i',
    formatLabel: 'HH:i'
})
}
else
{
$time_input = jQuery('.timepicker').pickatime({
    min: [6,00],
    max: [22,40],
    interval: 40,
    format: 'HH:i',
    formatLabel: 'HH:i'
})
}

I get the expected result for the 6:00am to 22:40pm picker but am not able to display a 5:40am to 22:20pm picker. It actually displays 5:20am then 6:00am, 6:40am which overlaps with the other option.
How can I achieve what I described?
I know that it is maybe the way pickadate.js is designed: which part of the code should I modify in order to get the expected result?
Thanks in advance.

@amsul amsul closed this as completed in 2cc3f8e Oct 13, 2013
@sgerin
Copy link
Author

sgerin commented Oct 13, 2013

Thanks for 3.3.0! Problem solved.

@amsul
Copy link
Owner

amsul commented Oct 13, 2013

🍻

@sgerin
Copy link
Author

sgerin commented Oct 14, 2013

@amsul, I think the problem discussed here may remains when setting min and max via the set method.

    $time_input = jQuery('.timepicker').pickatime({
        interval: 40,
        format: 'HH:i',
        formatLabel: 'HH:i'
    })

    time_picker = $time_input.pickatime('picker')

    time_picker.set('min', [5,40]);
    time_picker.set('max', [22,20]);

With this code the time picker displays 5:20am as the first time available.

@amsul amsul reopened this Oct 30, 2013
@amsul amsul closed this as completed in 091a118 Dec 5, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants