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

Setting time dynamically with onSelect() #137

Closed
Gumster opened this issue Mar 4, 2019 · 1 comment
Closed

Setting time dynamically with onSelect() #137

Gumster opened this issue Mar 4, 2019 · 1 comment

Comments

@Gumster
Copy link

Gumster commented Mar 4, 2019

I'm using the onSelect method and want to restrict the timepicker to enabled_hours only. For example, I need enabled_hours on a Friday to be different from those on a Saturday, so if a Saturday is selected, my code changes the enabled_hours array OK, but the subsequent timepicker always initialises to the current hour, even if I set_date() with the first value of the enabled_hours array.

In the following example, I want to set_date with an hour of '12', where o is the date object in the callback of onSelect()

zdp.settings.enabled_hours = [12, 13, 14];
o.setHours(zdp.settings.enabled_hours[0]);
zdp.set_date(o);
zdp.update();

but, what actually happens is the timepicker chooses the current hour regardless of the hour in date object o, but, if changed using the up/down arrow, snaps to the enabled_hours, which is confusing. How do I set the hour to the 1st value in the enabled_hours?

@stefangabos
Copy link
Owner

I wrote a solution for this - see #153

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

No branches or pull requests

2 participants