Changing Unit of Time Picker Does Not Send Change Event
Describe the bug
Changing the unit chooser of a time picker will update the spinner's representation of the duration, however it does not trigger the change event.
Also the Duration.String() output is not correct when you change the units chooser.
How to reproduce
This can be observed in the example from the docs https://www.cogentcore.org/core/time-picker#duration-input
Change the units value via the chooser, no snackbar. Change the spinner value, snackbar appears, note that the units output in the snackbar are incorrect.
Example code
Relevant output
Platform
Linux
Thank you for filing this issue. The reason a change event is not sent is because changing the unit technically does not change the actual time value (ex: if it says 60 minutes and you change the unit to hours, it goes to 1 hour, which is still the same as 60 minutes). However, if you think it should send a change event, I would be open to changing that behavior (another question is whether it should renormalize it at all: should changing it to hours instead make it 60 hours in the example above?).
For the output in the snackbar, it is just doing dt.Duration.String(), which is a stdlib function time.Duration.String, which we have no control over. If you need, we could add a function for formatting the value as specified by the unit.
Super good questions. The UX around this widget is kinda rough and confusing.
I could go either way on the lack of a change event. The main use case I have is to inform the user when an unsaved change exists, and offer a button to reset all of those changes to default.
Hard to say on the renormalizing. My kneejerk reaction would be yes in my use case. Set the number, edit the units, commit the changes seems intuitive to me, which would also make a stronger argument in favor of the change event on the chooser. But I could possibly see the use case where someone might be interested in equivalent units too.
One of the main issues is that there appear to be rounding errors if you start playing around with units and numbers. IE: 1 minutes outputs 1m0.000002048s whereas 1 hour is actually slightly less than an hour.
I would expect the duration to output predictably in the same way that the stdlib does. See: https://go.dev/play/p/oWImJrK-lir