-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Adds support for Seconds to TimePicker #16079
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d0e65b3
Adds seconds support to TimePicker.
begleysm a81260a
Updates TimePicker to support UseSeconds. Seconds are not displayed u…
begleysm ab9dbb4
Fixes & updates Unit Tests related to adding Seconds & UseSeconds to …
begleysm a3e2a16
Merge branch 'master' of https://github.com/AvaloniaUI/Avalonia
begleysm 85495aa
Adds a simple TimePicker with seconds enabled to DateTimePickerPage.…
begleysm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current behaviour with a time that includes seconds when
UseSeconds = false
is to keep the seconds, which may be misleading, particular as the time span defaults to the current time, so a user can select a time, but be off by 0-59 seconds without knowing it. (This is a breaking change)I think it would be better to exclude the seconds when
UseSeconds = false
; I'm not sure what would be the right behaviour when settingUseSeconds = true
having already beenfalse
, but my instinct is that it should be cleared to zero.(I'm happy to work on this feature if useful; may suffice to update
OnConfirmed
inTimePickerPresenter
; this comment is not attached to a relevant piece of code)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch.
Interestingly (in the absence of it being set manually with
UseSeconds == true
),newTime.Seconds
appears to be set to be equal to the current time when the Control is first clicked on (not when it is first loaded or when the check button is clicked to set the time) and then stays that way forever (doesn't update even when the Control is clicked again or another control is clicked and then this control is clicked again). I'm not, currently, entirely sure why this is and it also isn't super relevant to this particular issue.Changing the modified line to
causes 0 to be used for seconds when
UseSeconds == false
& the selected seconds to be used for seconds whenUseSeconds == true
. But it doesn't, alone, address the case whereUseSeconds
switches fromfalse
totrue
.Regarding when
UseSeconds == false
changes toUseSeconds == true
. That is also a good edge case you've identified. We can detect this case in theUseSeconds
portion of theOnPropertyChanged
override method.We can detect that
UseSecond
went fromfalse
totrue
and pass an argument toSetSelectedTimeText()
to indicate that 0 should be used for seconds.It could look something like this which should result in
UseSeconds == false
UseSeconds == true
but we came this method becauseUseSeconds
went fromfalse
totrue
UseSeconds == true
but was not just changed fromfalse
) using the SelectedTime.Seconds for secondsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having messed around a bit, I'm still not sure what the correct behaviour should be. I'm happy enough with the behaviour of us setting the
seconds
to zero when completing an interaction; trivial change is in VisualMelon@7e4df0f along with trivial example. It doesn't exercise the scenario where you have another control/piece of code updating the time whileUseSeconds
is false, and then setting it to true, but again, not sure what the behaviour should be, so may well warrant something more interestingThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I've not been more active on this; we should probably create an issue for it, as it is a serious breaking change and don't want it to get lost: I'll try to remember to do so on the weekend if no-one beats me to it.