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

Error when mobile #9

Open
projct1 opened this issue Jun 8, 2019 · 5 comments
Open

Error when mobile #9

projct1 opened this issue Jun 8, 2019 · 5 comments
Labels

Comments

@projct1
Copy link

projct1 commented Jun 8, 2019

Hio)
http://skrinshoter.ru/s/080619/aQdkvR03
Flatpickr using native mobile picker. I guess problem is with this.

@jcsmorais
Copy link
Owner

@projct1 thanks for your issue report 👍

Which versions are you using for both, flatpickr and shortcut-buttons-flatpickr?
Can you provide a jsfiddle/codepen example so that I can easily reproduce the behavior you're reporting?

Thanks

@projct1
Copy link
Author

projct1 commented Jun 8, 2019

@jcsmorais plugin is 0.3.0, flatpickr is 4.5.7
I cant create fiddle :(
Below my code and initialization.

require('flatpickr').localize(require('flatpickr/dist/l10n/ru').default.ru);

flatpickr.setDefaults({
    plugins: [
        require('shortcut-buttons-flatpickr')({
            button: [
                {label: 'Сегодня'},
                {label: 'Завтра'},
                {label: 'Послезавтра'}
            ],
            onClick(index, fp) {
                let date = index ? new Date(Date.now() + 24 * index * 60 * 60 * 1000) : new Date;

                fp.setDate(date, true);
                fp.close();
            }
        })
    ]
});

$('[name=date]').flatpickr();

@jcsmorais
Copy link
Owner

jcsmorais commented Jun 9, 2019

@projct1 based on your information I created this codepen where I was able to reproduce the issue.

This is actually the first time I'm testing flatpickr on mobile, according to the documentation if a mobile devices is detected it falls back to native date/time/datetime picker.

So a quick fix would be to just disable shortcut-buttons-flatpickr plugin once a mobile device is detected.

A long term fix would be to make it work on mobile devices the same way it does for web apps.

Let me know if you have any thoughts around that.

@projct1
Copy link
Author

projct1 commented Jun 9, 2019

@jcsmorais Thanks)
Can you add check, if flatpickr instance is array after init http://skrinshoter.ru/s/090619/y0pnhC0u => http://skrinshoter.ru/s/090619/wm7tNWyH then disable? :)

@jcsmorais
Copy link
Owner

@projct1 sorry for the late reply.
I definitely can, just ran out of time to do so in the last few weeks - should be able to get that done sometime soon.

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