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

DateTimePicker picker control for time #8

Open
DJViking opened this issue Sep 29, 2017 · 7 comments
Open

DateTimePicker picker control for time #8

DJViking opened this issue Sep 29, 2017 · 7 comments

Comments

@DJViking
Copy link

The DateTimePicker does not have a TimePicker, just a DatePicker. The button opens the same calendar as the DatePicker.

@edvin
Copy link
Owner

edvin commented Sep 29, 2017

That's right, it currently only allows you to pick the date and you have to write the time yourself. I did it like this because it's more convenient IMO. Picking the time just takes more time (pun intented), but for date you might need to consult a calendar. There is only one button, so this shouldn't be confusing, but I'd be up for adding a time picker in form of two spinners perhaps, if that's what you're envisioning?

Any feedback or sketch you can provide with regards to layout suggestions are most welcome :)

@DJViking
Copy link
Author

The project ControlsFX started with a TimePicker, but it did not make it.
https://bitbucket.org/controlsfx/controlsfx/pull-requests/522/new-control-timepicker/diff

There is even a JDK feature request for a TimePicker.
https://bugs.openjdk.java.net/browse/JDK-8090397
Java has LocalTime, LocalDate, LocalDateTime. It should definitely have JavaFX control for each of these.

The project JFoenix has a similar TimePicker implementation:
https://github.com/jfoenixadmin/JFoenix
timepicker

Such a similar TimePicker could be implemented as a second popup after choosing the date.

@edvin
Copy link
Owner

edvin commented Sep 29, 2017

Certainly possible, but I think we're better off reimplementing the date picker to support grater freedom and control over the functionality and design. The DateTimePicker in it's current form is simply a hack around the stock DatePicker. I don't have time to look at this right now, but a PR would be most welcome :)

@iameddz
Copy link

iameddz commented Oct 26, 2017

I would also look forward to a TimePicker!

@DJViking
Copy link
Author

The time picker could be implemented as sliders, perhaps something similar like the Android date time picker.
Screenshot_20190314-203309

@edvin
Copy link
Owner

edvin commented Mar 19, 2019

That design works on mobile but seems quite cumbersome to use on a desktop IMO.

@owan1024
Copy link

Works fine with one small comment. Edit of the time gets lost if you re-pick the date. Think this would be solved for example by using the editor text string (or perhaps adding a commit ).

replace: time = localDateTime.toLocalTime();
with: time = LocalDateTime.parse(this.getEditor().getText(), formatter).toLocalTime();

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

4 participants