< 052023-02-06⋎07 >

Topic for #farmOS is: farmOS (farmos.org) is a free and open source, web-based farm management system. User guide: farmos.org/guide/ - Forum: farmOS.discourse.groupSet by mstenta on 2021-06-15 at 12:52
00:47symbioquine[m]> <@mstenta:matrix.org> > I think it is still valuable to set the time in many scenarios even when the user mostly "doesn't care" about it.
00:47symbioquine[m]>
00:47symbioquine[m]> Existing behavior doesn't change (if i'm understanding your thoughts), the time field just gets hidden with a link to show it. The default value of the time is the same with all these changes.
00:47symbioquine[m]Hmmm, I guess I'm probably misunderstanding github.com/farmOS/farmOS/pull/635 then...
00:49symbioquine[m]I was seeing diff lines like;... (full message at <libera.ems.host/_matrix/media/v3/downloa>)
00:50symbioquine[m] * > Existing behavior doesn't change (if i'm understanding your thoughts), the time field just gets hidden with a link to show it. The default value of the time is the same with all these changes.
00:50symbioquine[m]Hmmm, I guess I'm probably misunderstanding github.com/farmOS/farmOS/pull/635 then...
00:55symbioquine[m]Okay, maybe I'm seeing what's going on better now... github.com/farmOS/farmOS/pull/635 probably does have that effect, but only in some specific cases like the planting quick form and the bulk "move"/"group" assets actions. Those places are only a subset of the forms that github.com/farmOS/farmOS/pull/637 would affect - most of the later retaining their existing behaviour of using the current time.
00:55symbioquine[m]Does that sound right?
01:00mstenta[m]Yea that's correct... and date('Y-m-d', ...) is the same as "midnight" so those didn't change
01:00mstenta[m]Basically it was taking the current date (without time) and converting it to a timestamp
01:01symbioquine[m]I guess that makes sense
01:01mstenta[m]The change kinda just made it more explicit by actually saying "midnight" :-)
01:02mstenta[m]And yea all the other forms still work the same
01:02symbioquine[m]Cool
16:54paul121[m]It would be cool if the "Show time" toggle was enabled by saying `#date_time_element => 'optional'`
16:56paul121[m]I was also thinking we should consider modifying our datetime_timestamp_optional field widget so it exposed some configuration for these #date_time_element options. The default datetime_timestamp widget we extend is kinda boring... :D
16:57paul121[m]It would be nice if you could specify any of the following 1) Require date & time 2) Require date, allow optional time and 3) Require date, do not allow time
16:58paul121[m]we would probably default to option 2) for most places in farmOS: require date, allow optional time
16:59paul121[m]but this might be a nice way to make that flexible
17:03*uploaded an image: (205KiB) < libera.ems.host/_matrix/media/v3/downloa >
17:10mstenta[m]Oh neat ideas paul121 - I forgot about our `datetime_timestamp_optional` field widget 😄
17:11mstenta[m]There is another distinction with all of this as well, perhaps: validation/constraints
17:12mstenta[m]The PR I opened is just a client side UI enhancement, doesn't enforce anything
17:12mstenta[m]> It would be nice if you could specify any of the following 1) Require date & time 2) Require date, allow optional time and 3) Require date, do not allow time
17:12mstenta[m]eg: these feel like they would imply validation/constraint logic perhaps
17:14paul121[m]Yeah that's true. But if you're going to require a date, or require a date and a time... the "show time" toggle doesn't seem necessary
17:15mstenta[m]agreed
17:19mstenta[m]> I forgot about our `datetime_timestamp_optional` field widget 😄
17:19mstenta[m]Hmm so... is this related at all to github.com/farmOS/farmOS/issues/625?
17:19mstenta[m]Seems like the bug described there is exactly what datetime_timestamp_optional intended to solve...? Trying to dig through the history to remember...
17:19mstenta[m]Do you recall?
17:20paul121[m]Not quite. datetime_timestamp_optional fixed behavior where a timestamp would be saved, even if the user did not enter anything into the field widget.
17:20mstenta[m]Oh hmm
17:20paul121[m]eg: open animal asset form, do not touch the birth date field, but one would end up being saved
17:20paul121[m]* being saved (as current time)
17:21mstenta[m]ooooooh right i remember now
17:21paul121[m]really odd
17:21mstenta[m]thanks for the brain jog :-)
17:22mstenta[m]ah so... that makes me think... one (small) potential UX pitfall of "Show time" is: in optional date fields that don't get populated with a default value, if you just fill in a date and click save (without clicking "Show time" and entering a time) the validation would fail
17:22mstenta[m]unless we also added some logic to prefill time with 00:00:00 in those cases (somehow)
17:23mstenta[m]maybe some general logic to solve github.com/farmOS/farmOS/pull/636 would just be: if a date is saved without a time, set the time to 00:00:00?
17:24paul121[m]Yeah I think that is correct
17:24paul121[m]I think we're entering the realm of a custom form element haha
17:24symbioquine[m]paul121[m]: I think this is the correct behaviour - IMHO :)
17:25symbioquine[m]oh wait...
17:25symbioquine[m]Less for birth date
17:25symbioquine[m]Was thinking more like log creation time
17:25paul121[m]haha well for animal birth date that might be OK. But for other optional date/time fields it seems less ideal
17:25symbioquine[m]paul121[m]: Example?
17:26paul121[m]yeah it seems like the `datetime_timestamp` widget was kind designed for "entity created/changed time" ...
17:26paul121[m]I believe the lab test logs have two timestamps: received time & processed time (in addition to log timestamp)
17:26mstenta[m]so... could we just standardize everything on `datetime`? and add some submit logic to allow empty time, and add this "show time"?
17:27mstenta[m](might not need a custom element?)
17:27mstenta[m](i'm mixing a few things together here... trying to solve multiple problems perhaps)
17:28mstenta[m]We were using datetime_timestamp: github.com/farmOS/farmOS/commit/0416267c
17:28symbioquine[m]mstenta[m]: But if the field isn't required, it should just be possible to leave it empty already right?
17:29mstenta[m]But maybe we could just use datetime?
17:29mstenta[m]symbioquine: yes agreed - if it's not required and it is empty, it should be possible to leave it blank
17:29mstenta[m]i think these two changes (back in pre-alpha i think?) fixed a bug we found with that...
17:29mstenta[m]github.com/farmOS/farmOS/commit/0416267c
17:29mstenta[m]github.com/farmOS/farmOS/commit/79693d28
17:29mstenta[m]I don't remember if there was a reason we used datetime_timestamp for that originally though (and not datetime)
17:30paul121[m]datetime = form element, datetime_timestamp = field widget
17:30mstenta[m]OHHH right.
17:30mstenta[m]thank you paul121 :-)
17:32paul121[m]I worry that modifying/altering the datetime form element may have unintended consequences. It's quite a low-level Drupal core thing, and other modules/fields/forms/etc may depend on its existing behavior (whether we think that behavior is right or wrong)
17:32mstenta[m]and we have two scenarios to solve for: Field API (higher level) and Form API (lower level)
17:33mstenta[m]yea that's the risk on my mind too
17:36mstenta[m]well, so just to bring it all back to specifics... it seems like this is the main issue with the current PR:
17:36mstenta[m]> one (small) potential UX pitfall of "Show time" is: in optional date fields that don't get populated with a default value, if you just fill in a date and click save (without clicking "Show time" and entering a time) the validation would fail
17:36mstenta[m]which *I think* (correct me if i'm wrong) is essentially the same "bug" (or just UX issue) reported here: github.com/farmOS/farmOS/issues/625
17:37mstenta[m]they can't be solved the same way, necessarily, though... because of the two levels involved (Field API vs Form API)
17:38mstenta[m]because it requires validate/submit logic (I think) - which we COULD control in Field API, but not in Form API
17:39mstenta[m](although maybe there's a way we could via a custom form element w/ validate method that populates time to 00:00:00 if one isn't set, but a date is)
17:47paul121[m]<mstenta[m]> "because it requires validate/..." <- I'm not sure, some of the validation might bubble up from form API! I wouldn't be surprised but haven't looked closely enough
17:47mstenta[m]> (although maybe there's a way we could via a custom form element w/ validate method that populates time to 00:00:00 if one isn't set, but a date is)
17:47mstenta[m]yea, that was where my mind went next with this^
17:47mstenta[m]element-level validation
21:56*YashGoel[m] has quit (*.net *.split)
22:06*YashGoel[m] has joined

< 052023-02-06⋏07 >