| 00:47 | symbioquine[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:47 | symbioquine[m] | > |
| 00:47 | symbioquine[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:47 | symbioquine[m] | Hmmm, I guess I'm probably misunderstanding github.com/farmOS/farmOS/pull/635 then... |
| 00:49 | symbioquine[m] | I was seeing diff lines like;... (full message at <libera.ems.host/_matrix/media/v3/downloa>) |
| 00:50 | symbioquine[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:50 | symbioquine[m] | Hmmm, I guess I'm probably misunderstanding github.com/farmOS/farmOS/pull/635 then... |
| 00:55 | symbioquine[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:55 | symbioquine[m] | Does that sound right? |
| 01:00 | mstenta[m] | Yea that's correct... and date('Y-m-d', ...) is the same as "midnight" so those didn't change |
| 01:00 | mstenta[m] | Basically it was taking the current date (without time) and converting it to a timestamp |
| 01:01 | symbioquine[m] | I guess that makes sense |
| 01:01 | mstenta[m] | The change kinda just made it more explicit by actually saying "midnight" :-) |
| 01:02 | mstenta[m] | And yea all the other forms still work the same |
| 01:02 | symbioquine[m] | Cool |
| 16:54 | paul121[m] | It would be cool if the "Show time" toggle was enabled by saying `#date_time_element => 'optional'` |
| 16:56 | paul121[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:57 | paul121[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:58 | paul121[m] | we would probably default to option 2) for most places in farmOS: require date, allow optional time |
| 16:59 | paul121[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:10 | mstenta[m] | Oh neat ideas paul121 - I forgot about our `datetime_timestamp_optional` field widget 😄 |
| 17:11 | mstenta[m] | There is another distinction with all of this as well, perhaps: validation/constraints |
| 17:12 | mstenta[m] | The PR I opened is just a client side UI enhancement, doesn't enforce anything |
| 17:12 | mstenta[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:12 | mstenta[m] | eg: these feel like they would imply validation/constraint logic perhaps |
| 17:14 | paul121[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:15 | mstenta[m] | agreed |
| 17:19 | mstenta[m] | > I forgot about our `datetime_timestamp_optional` field widget 😄 |
| 17:19 | mstenta[m] | Hmm so... is this related at all to github.com/farmOS/farmOS/issues/625? |
| 17:19 | mstenta[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:19 | mstenta[m] | Do you recall? |
| 17:20 | paul121[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:20 | mstenta[m] | Oh hmm |
| 17:20 | paul121[m] | eg: open animal asset form, do not touch the birth date field, but one would end up being saved |
| 17:20 | paul121[m] | * being saved (as current time) |
| 17:21 | mstenta[m] | ooooooh right i remember now |
| 17:21 | paul121[m] | really odd |
| 17:21 | mstenta[m] | thanks for the brain jog :-) |
| 17:22 | mstenta[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:22 | mstenta[m] | unless we also added some logic to prefill time with 00:00:00 in those cases (somehow) |
| 17:23 | mstenta[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:24 | paul121[m] | Yeah I think that is correct |
| 17:24 | paul121[m] | I think we're entering the realm of a custom form element haha |
| 17:24 | symbioquine[m] | paul121[m]: I think this is the correct behaviour - IMHO :) |
| 17:25 | symbioquine[m] | oh wait... |
| 17:25 | symbioquine[m] | Less for birth date |
| 17:25 | symbioquine[m] | Was thinking more like log creation time |
| 17:25 | paul121[m] | haha well for animal birth date that might be OK. But for other optional date/time fields it seems less ideal |
| 17:25 | symbioquine[m] | paul121[m]: Example? |
| 17:26 | paul121[m] | yeah it seems like the `datetime_timestamp` widget was kind designed for "entity created/changed time" ... |
| 17:26 | paul121[m] | I believe the lab test logs have two timestamps: received time & processed time (in addition to log timestamp) |
| 17:26 | mstenta[m] | so... could we just standardize everything on `datetime`? and add some submit logic to allow empty time, and add this "show time"? |
| 17:27 | mstenta[m] | (might not need a custom element?) |
| 17:27 | mstenta[m] | (i'm mixing a few things together here... trying to solve multiple problems perhaps) |
| 17:28 | mstenta[m] | We were using datetime_timestamp: github.com/farmOS/farmOS/commit/0416267c |
| 17:28 | symbioquine[m] | mstenta[m]: But if the field isn't required, it should just be possible to leave it empty already right? |
| 17:29 | mstenta[m] | But maybe we could just use datetime? |
| 17:29 | mstenta[m] | symbioquine: yes agreed - if it's not required and it is empty, it should be possible to leave it blank |
| 17:29 | mstenta[m] | i think these two changes (back in pre-alpha i think?) fixed a bug we found with that... |
| 17:29 | mstenta[m] | github.com/farmOS/farmOS/commit/0416267c |
| 17:29 | mstenta[m] | github.com/farmOS/farmOS/commit/79693d28 |
| 17:29 | mstenta[m] | I don't remember if there was a reason we used datetime_timestamp for that originally though (and not datetime) |
| 17:30 | paul121[m] | datetime = form element, datetime_timestamp = field widget |
| 17:30 | mstenta[m] | OHHH right. |
| 17:30 | mstenta[m] | thank you paul121 :-) |
| 17:32 | paul121[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:32 | mstenta[m] | and we have two scenarios to solve for: Field API (higher level) and Form API (lower level) |
| 17:33 | mstenta[m] | yea that's the risk on my mind too |
| 17:36 | mstenta[m] | well, so just to bring it all back to specifics... it seems like this is the main issue with the current PR: |
| 17:36 | mstenta[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:36 | mstenta[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:37 | mstenta[m] | they can't be solved the same way, necessarily, though... because of the two levels involved (Field API vs Form API) |
| 17:38 | mstenta[m] | because it requires validate/submit logic (I think) - which we COULD control in Field API, but not in Form API |
| 17:39 | mstenta[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:47 | paul121[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:47 | mstenta[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:47 | mstenta[m] | yea, that was where my mind went next with this^ |
| 17:47 | mstenta[m] | element-level validation |
| 21:56 | * | YashGoel[m] has quit (*.net *.split) |
| 22:06 | * | YashGoel[m] has joined |