mkpaz / atlantafx

Modern JavaFX CSS theme collection with additional controls.
https://mkpaz.github.io/atlantafx
MIT License
791 stars 64 forks source link

Calendar does not initialize with date #83

Closed rzillmann closed 3 weeks ago

rzillmann commented 7 months ago

Hello, after using AtlantaFX it came to my attention that the Calendar does initiate the ui and the model differently which is kind of unintuitive and a little annoying. I think the displayed value and the underlying value should match.

Used theme: cupertino dark

Expected behaviour

If a Calendar is instantiated (code or via fxml) i want to see the current date ( if not stated otherwise) is displayed visualized in the component after the ui is displayed.

If i call getValue i want to get the current date

Actual behaviour The current date is displayed in the UI correctly getValue returns null

Ways to reproduce After instantiating a Calendar call getValue without setting the value before

rzillmann commented 4 months ago

Just stumbled across the same problem with DatePicker, setValue does not set the Value in the field anymore. Checked it against a plain javafx Datepicker and there it gets displayed correctly

mkpaz commented 1 month ago

Sorry, I don't follow. There is indeed a bug in the calendar constructor, but it's not related to this issue.

If I instantiate a calendar with null value, getValue() returns null and the skin only highlights today's (.today) but not selected (.selected) value.

image

If I instantiate a calendar with non-null value, it displayed correctly and getValue() returns that value.

Just stumbled across the same problem with DatePicker, setValue does not set the Value in the field anymore. Checked it against a plain javafx Datepicker and there it gets displayed correctly

It's the same control. I created (copy-pasted, actually) the Calendar only because JavaFX doesn't export DatePickerContent and inline date picker is kinda mandatory these days.

rzillmann commented 4 weeks ago

My bad you are absolutly right. I got bamboozled pretty good by the two blue tones and the fact i was working with today. Was totally not thinking of "thats a generic today marker" so my wording was bad. I would like to change this to a question:

What's the reason for not setting today as default instead of null? I can't even "unselect" if i clicked a date once

mkpaz commented 3 weeks ago

For example, when it comes to validation, it's important to know whether the user has selected something or not in order to provide more informative error messages. "You need to select a date" versus "Your date is greater than X". So, I think null value is really important here.

As for unselecting, that like pretty much everyone datepicker works 1, 2, 3. The Calendar supports two optional slots: top and bottom. You can put a unselect button here if you need to.

TickTick:

image

Trello:

image

rzillmann commented 3 weeks ago

True, thank you for the clarification