Bug: multiple userfields of type datetime go boom - grocy

https://test-1bm7m5s3o3b0mtoqogevkl.demo.grocy.info/product/new

I created a test instance, added three datetime userfields (no time) and one datetime with date to the product object. On the linked page, the following behavior is observed:

  1. Keyup/Keydown on one picker modifies the value of all pickers.
  2. The Date with time looses its time because the format for all datetimepickers is taken from the first datetimepicker component on the page (this also means that behavior could change from page to page or even embeds).

Unfortunately, I don't think that's easily fixable with the way the js and its components currently work; a workaround like datetimepicker2 doesn't work for an unknown number of datetimepickers.

1510 is not affected by this issue once I push all my scoping commits.

Asked Sep 25 '21 13:09
avatar mistressofjellyfish
mistressofjellyfish

4 Answer:

Unfortunately, I don't think that's easily fixable with the way the js and its components currently work;

It's JS, everything is always possible somehow... :D https://github.com/grocy/grocy/commit/5e189c8a4af8480574b0e731dc0fe34c9d26007a

The datetimepicker2 workaround is definitely really bad, came from my initially totally wrong assumption that there will be no need to have any component multiple times per view, don't know why I though that...

1
Answered Jun 23 '21 at 20:18
avatar  of berrnd
berrnd

Copied your demo instance into a pre-release one: https://test-1bm7m5s3o3b0mtoqogevkl.demo-prerelease.grocy.info/product/new

1
Answered Jun 23 '21 at 20:23
avatar  of berrnd
berrnd

Looks good, yes. As you probably imagined, the fix in my PR is... drastically different and involves deleting code en masse. I'll resolve the merge conflict shortly.

1
Answered Jun 23 '21 at 20:25
avatar  of mistressofjellyfish
mistressofjellyfish

Unfortunately, the fix isn't complete yet: views/components/datetimepicker.blade.php still defines <div id="datetimepicker-wrapper" and thus producing invalid HTML.

My tooling says it can be safely changed to <div class="datetimepicker-wrapper".

1
Answered Jun 23 '21 at 21:54
avatar  of mistressofjellyfish
mistressofjellyfish