1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

date element has stopped storing time correctly, always 00:00:00. changed recently

Discussion in 'Professional Support' started by skyrun, Jan 30, 2019.

  1. skyrun

    skyrun Active Member

    Level: Professional
    posted to an existing report of this that was on the community forum, putting here so you can see it on the professional forum.

    of my new new form rows are timestamped 00:00:00 now. the date works, but the time is always 00:00:00. just started happening recently post-1/3/19 at least.

    i am using a 'hidden' date element (not timestamp element type) with Default to current date = Yes and Always return current date. = No. note in case it matters for debugging that i also use 'local time' for all of my date/times (NOT UTC).

    ***looking at another forum item, when i put in h:i:s on the form format, it puts in 12:00:00 so 12pm vs. the default H:i:s which puts in 00:00:00. so changing H to h does do something if that's a clue.

    I tried setting the default in the db to CURRENT_TIMESTAMP and fabrik is overriding it and storing with 00:00:00 or 12:00:00. (tried advanced formats = yes also on the advanced tab).

    The 'workaround' i found is to select Always return current date. = Yes. when i set it this way, the time works correctly on both new and edit.

    But i would like to be able to set Default to current date = Yes and Always return current date. = No to record when the row was created (not edited) and that has stopped working as far as the TIME goes.
     
    Last edited: Jan 31, 2019
  2. skyrun

    skyrun Active Member

    Level: Professional
    update: it also works if i make the Hidden = NO (and change it to 'nobody' for editing and/or details) as a way to hide the date. so it only seems to happen incorrectly with these settings:

    hidden = yes
    default to current date = yes
    Always return current date = no
    access for editing = public

    when i change hidden = no (and access = nobody) then it works ok
    or if i use the option to always return current date = yes, then it works ok even hidden (but changes on every edit vs. just creation).
     
    troester likes this.
  3. troester

    troester Well-Known Member Staff Member

    Level: Community
    I think this is related to the new jdate element and the new "time picker" in the old date element.

    The date part field is ignoring any time typed in it. You must set "show time picker" = yes to get a time field (where you can type or use the time picker).
    Which is not backward compatible: open and resave a record with a date element without time picker and your existing time is lost:(
     
  4. skyrun

    skyrun Active Member

    Level: Professional
    i would think it is a very common use-case to have a date_time that records when a record is created (but is not shown). we 'just' need it to be left alone if it's not changed (including if it's hidden).

    fyi, i tried with time selector turned on and that didn't fix it either. the only thing that fixed it was to make it NOT hidden and change the access so it didn't show (ie hide it that way vs. using 'hidden=yes'). so i changed all of mine to work that way (on almost 100 tables with the std date_time as a column where i recorded it and showed it on the list, but not on the form)

    wouldn't you agree this needs to be fixed?
     
  5. troester

    troester Well-Known Member Staff Member

    Level: Community
    Yes. I only described what I'm seeing (additionally) on my site.
     
  6. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Yup, I'm working on it.

    It's a bug that got introduced when I did a large refactoring of the date elements recently, finally getting the new J! date widget integrated (into the new jdate element) and fixing the dismal time selector in the original date element. But the latter involved changing how we handle the time format handling, and some problems crept in. Unfortunately it's some changes that absolutely had to happen, that I've been putting off since J! 3.7.2.

    I think one fix would be to use jdate instead of date elements, and I'm about to redo our default list element types to use that instead of date, where the time format handling is (relatively) unchanged.

    -- hugh
     
  7. troester

    troester Well-Known Member Staff Member

    Level: Community
    I can't use jdate as long as it doesn't support "allowed dates".
     
  8. troester

    troester Well-Known Member Staff Member

    Level: Community
    It's still the same with current GitHub
     
  9. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    OK, I'll do some more work on it today / tomorrow.

    -- hugh
     
  10. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Unfortunately, unless I add it to the J! date layout code, and a PR gets accepted by the J! gods (which is ... not likely), it'll never support allowed dates. That was a feature specific to the old 3rd party date widget, that didn't get carried forward into the new J! specific code.

    Which is one of the main reasons I created 'jdate' as a new element, and left the old 'date' element there, which we'll support as long as practical - but the version of the 3rd party widget it uses (DHTML calendar) is old and creaky (pretty much unchanged for as long as I've been using Joomla). There is an "all new" version, but it'd need a lot of work to support.

    -- hugh
     
  11. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community

Share This Page