Repository navigation
fix(datetime) update columns and validate value on change - #17562
KillerCodeMonkey wants to merge 14 commits into
Conversation
|
@liamdebeasi here is a little bit help needed. There is the problem that after validation render is not triggered again. So the calculation works and columns are created and disabled and the validated dateTime is used, but you need to do a haptic change so the correct day column gets selected. But in general i think this will improve the current datetime anyways :) |
liamdebeasi
left a comment
There was a problem hiding this comment.
There seem to be a few issues when using the datetime component:
- For February 2019, sometimes the "day" column shows up to 28 days, sometimes it shows up to 31 days (days 29-31 appear and disappear as I drag the "day" column)
- When going from January 31, 2019 to Feburary, 2019 the "day" column disappears entirely.
- When going from a day like January 30 to Feburary 28, it shows the correct number of days, but I would expect that the "day" column would default to the closest day and scroll that into view. So since I had January 30 selected, but the closest day in February is February 28, I would expect that the "28" would become selected.
Let me know if you need me to clarify any of those or provide examples. Thanks for opening this PR. We really appreciate all the hard work you've put into this so far!
|
@liamdebeasi yeah here i need a little bit help from you. i select the correct nearest date and it is correct in the datetime component, but the change of the selected columns in the picker is not updating correctly. And i do not know why? Maybe you can help here a little bit. |
|
@liamdebeasi i think i can get it!... one last thing :) |
|
@liamdebeasi after a long time hacking around. i am at a point where is only one little thing left. Know everything is updated correctly, but i call But i have to call this in a timeout so everything works like in the |
|
@liamdebeasi so i knocked it down to simply have a timeout of 0, but there is a little flickering left. |
|
Ok great. Yeah apart from that flickering, everything looks good. Ideally we shouldn't have that flickering. I'll try to jump into the code and see if I can make any suggestions. |
|
Problem ist Here that the pickercolumn uses CSS translates to positioning
the items. If one or More items are added i wanted to Reuse the default
picker column to avoid changing the whole pickercolumn class :).
I thought of Something like set visibility to Hidden and after the refresh
timeout Set them visible.
Liam DeBeasi <[email protected]> schrieb am Do., 28. Feb. 2019,
15:49:
… Ok great. Yeah apart from that flickering, everything looks good. Ideally
we shouldn't have that flickering. I'll try to jump into the code and see
if I can make any suggestions.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#17562 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACKOYBJzJbrPink2zLYJEf253KFjstAOks5vR-x6gaJpZM4bHeAR>
.
|
|
@liamdebeasi but maybe we can merge this back, so the datetime component is usable and works like expected. This would make many people happy. After that we can tackle the part, how to append new column options without that little flickering? |
|
@liamdebeasi i know why there is that flickering or not rendering when we remove the timeout. the update method uses the rendered button elements. So when you add a column you need to wait for it to render :S |
|
@liamdebeasi its doooooone... its over.... i tried my posted solution -> cols are intialized as hidden, and get visibile after first transformation. BTW: this pr will allow to listen on column changes in a picker and will allow to change picker cols on the fly 😎 |
|
This is looking a lot better! Nice work! The one thing I'm noticing is that inertia scrolling is no longer working as it did before. Try "flinging" one of the columns and then compare it to the one in our docs: https://ionicframework.com/docs/api/datetime It seems like it's snapping to the next item in the column a bit too aggressively. Maybe it has something to do with this? https://github.com/ionic-team/ionic/pull/17562/files#diff-c5ad26cc3f41bcf11e1dfd40af45212fR46 |
|
@liamdebeasi And it is me again 🤯. I investigated and came to this solution: i trigger the pickerColumnChange event only if the element is directly clicked (velocity === 0 in the onEnd method) or not decelerating (the case when notLockedIn is false in the decelerating function). So this avoids emitting a flood of events and associrated refresh calls. It only refreshs if the column is locked. |
|
@liamdebeasi i do not want to spam you, but maybe you want to check the latest fixes :) |
liamdebeasi
left a comment
There was a problem hiding this comment.
Looking really good! Can we remove the animation when changing updating column values? If you select April 28 and then select May, you see the 31 appear and then animate down out of view.
|
Sure Thing. If you want to do it, feel free. Otherwise i will Check that
tomorrow. :)
Liam DeBeasi <[email protected]> schrieb am Mo., 4. März 2019, 22:16:
… ***@***.**** commented on this pull request.
Looking really good! Can we remove the animation when changing updating
column values? If you select April 28 and then select May, you see the 31
appear and then animate down out of view.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#17562 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACKOYFMsMdM-jsfosxu4PnUibH6C-mo5ks5vTY0_gaJpZM4bHeAR>
.
|
|
@liamdebeasi here we go again :D |
|
I think we're almost there! I'm wondering if we can do anything about the scroll cancelling occurring when changing columns. For example, if you flick a time column and then change the month, the time column abruptly snaps to the nearest values whereas previously it would continue to scroll until it "eased" to a stop. My guess is this is happening due to the column recalculations we're doing? Is there any easy way to determine whether or not we need to recalculate a column? For example, changing the month column should have no bearing on what the hour column is doing. Let me know if you need any clarification! |
|
@liamdebeasi now i merge old columns with the new generated ones, so only the columns with changes get the update. Seems like this does not cancel the flick of a column that is not affected of the previous column change. The event i introduced is passing the column that changed, as additional data, but if you change the year - day, hour and minutes can change, because of max/min settings or like in leap years the days of feburary changes. So i think it is easier to generate all columns and merge the object together. If this will be a performance killer we can refactor the column generation, but i trying to avoid that for now :) |
|
@liamdebeasi maybe today is the day :D |
- allow to set update options when refresh is called - use timeout of 0
…celerating or velocity is 0 onEnd
- set noAninmate to true for the refresh - reset refresh method to original params
Trigger picker column update only for columns that changed
|
Sorry for just getting to this now. It looks like something broke -- going from March --> February no longer updates the "days" column (i.e. I can still select February 31, 2019). I did make a few updates earlier this week to how datetime values are parsed/formatted relative to the user's timezone, but not sure that would cause issues. Can you verify on your end if things are working as you'd expect? |
|
@liamdebeasi i added to update only changed columns to avoid that #17562 (review) this seems no longer to work... -.-" |
|
@liamdebeasi seems like this is not solvable that easy (because of stenciljs immutable bindings). maybe i revert my latest changes and we merge it back and work up on this? I think this pr gives the ionic community a mostly working datetime picker? |
|
@liamdebeasi wait for it^^... i had another idea. Filtering the changes i want in the pickercolumn and only triggering refreshing if something changed! Now my head is empty. Hope this works for you. Space for improvement: i simply use JSON.stringify to compare old and new col value. This works, because the cols are simple and not deep nested objects. |
Update col only when it really changes. Hold the col value on an internal state and check on col prop updates, if the col really changed. This avoids useless rerenderings and refresh of picker colums.
|
@liamdebeasi i remove PropWillChanged in favor of watch |
|
I would like to try and also close out this older datetime PR: #14434 As a result, I have setup a branch that has a combination of your changes and changes the other contributor made. I tested and it seems to be working well. It would be great if you could also test it and let me know if you see anything wrong. I still need to write more automated tests, so that will have to be done before it gets merged. Here is the branch: https://github.com/ionic-team/ionic/tree/datetime-col-change Thanks! |
|
@liamdebeasi seems to work! 👍 If you need more info for the tests. let me know. 🙃 |
|
Any info you have on tests would be great! Thanks! |
|
@liamdebeasi i only know how you write unit tests and not checked the e2e tests, yet. But there are to things to tests:
|
|
Hi there, This issue has been resolved by #17846. You have been added as a co-author in that commit due to your contributions here. Thank you very much for the work you put into this PR! |



Short description of what this resolves:
Dynamic datetime validation depending on current selection
Changes proposed in this pull request:
For correct Month days validation checkout #17558
Ionic Version:
4.0.2
Fixes: many of #16630