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

Timepicker #25

Open
asieverding opened this issue May 28, 2020 · 9 comments
Open

Timepicker #25

asieverding opened this issue May 28, 2020 · 9 comments

Comments

@asieverding
Copy link

Hey, love your vanillajs date picker!
Are there any plans to include a time picker?

@BariqDharmawan
Copy link

Love to know if there's one

@mymth
Copy link
Owner

mymth commented Jan 17, 2021

There are no plans for it at the moment.Since it's highly likely to need fundamental design changes, the possibility to have a plan in the near future is not so high, unfurtunately.

@stsrki
Copy link

stsrki commented May 19, 2021

Hi @mymth, did you consider making Timepicker a separate project instead?

@mymth
Copy link
Owner

mymth commented May 23, 2021

@stsrki,
Unfortunately no. I personally never had opportunities to need time picker and it seems unlikely to have one in the near future. My motivation for it is not really high, to be honest.

@lubomirblazekcz
Copy link

What about timepicker as part of datepicker? Same functionality as https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local

obrazek

If anyone wants, I manage to cooked in the timepicker here https://github.com/newlogic-digital/ui/blob/main/src/scripts/Ui/Input.js#L102 it uses native type="time" input, can be used also with https://github.com/epavanello/input-time-polyfill

@xdev1
Copy link
Contributor

xdev1 commented Jun 5, 2022

I personally kinda like how the air datepicker is handling time selection:
https://air-datepicker.com/examples (click "Timepicker" in the menu)

It also has an option to show only the timepicker (without the datepicker part):
https://air-datepicker.com/docs?scrollTo=onlyTimepicker

@mymth Would a solution like this also mean "fundamental design changes"?

@mymth
Copy link
Owner

mymth commented Jun 6, 2022

@xdev1 This is why I think "fundamental"

The time value of local time 00:00:00.000 of the date is used for the internal date value.
https://mymth.github.io/vanillajs-datepicker/#/overview?id=providing-date

All dates given to date picker are converted to the time values of their local time 00:00:00.000 for internal use. This is to make these possible, to use Array.prototype.includes() on selected/disabled dates arrays and to compare dates with simple arithmetic comparison.

Other hurdles for this library but not for Air Datepicker are...
- This library has its own parser and it needs to be enhanced in order to allow users to edit the time string in the input field as well as the date string. (Air Datepicker doesn't have parser—for date string, it only accepts ones that the Date class constructer can parse—and it doesn't allow users to edit the text in input field.)
- This library includes more locales (many of them are non-Western European languages'). They need to be updated to include time format, but they are just a copy of bootstrap-datepicker's and I have no knowledge on most of those languages.

@xdev1
Copy link
Contributor

xdev1 commented Jun 9, 2022

@mymth Thank you very much for the detailed information.

@buncis
Copy link

buncis commented May 17, 2023

this library is perfect until I realize I also need time instead just date, damn I wish I could still use this clean simple tiny vanilla js library

@mymth for the second part I think you should not focus on it, let the community update their own locale

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

7 participants