• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Time Stamp in List only in AM

emcguire

Member
Hi!

I have a hidden date field in my form that just records the date/time of when the form is submitted. I have it set to UTC time ( I had problems with Local Time)

In the format, I have it set for form and list to:

m/d/Y g:i a
which should return ie: 03/24/2017 4:29PM
but it is returning 03/24/2017 4:29AM

Yet, in the list, all times listed are "am" even when they are supposed to be "pm" I've tried switching iot to a "A" in the format, but it is always AM for some reason?

Not sure what's happening here...
 
Are the times correct in the underlying table, if you look with something like phpMyAdmin?

I just tested, and it's showing PM correctly for me.

-- hugh
 
Well, in the db the date is 2017-03-17 08:29:00 - in the list it reads 03/17/2017 4:29am. Which is even more confusing. I know this particular record was put in at 4:29PM local time. So I'm not sure why the db value is 08:29:00. I have my global Joomla set at New York TZ (EST) . Is there another fabrik TZ setting?
 
Hmmm.

Exactly what are your settings? Do you have "Always return today's date" set? And what do you have the "Show time selector" set to?

I just noticed that on the test I just set up, with a hidden date, "Always return today's date", and the same formats as you, it's double dipping the TZ offset when saving. So 2:46pm today (24th) is storing as 00:46 on the 25th (I'm GMT-5) in the database, and showing in the list as 7:46pm.

Grrrr. God I hate TZs and the date element.

Working on it.

-- hugh
 
Yeah, I know. They are a pain. Attached my settings.
 

Attachments

  • download.png
    download.png
    32.7 KB · Views: 37
  • download (2).png
    download (2).png
    19.3 KB · Views: 31
  • download (1).png
    download (1).png
    16 KB · Views: 38
I just put in a test (w those settings) - db reads 2017-03-24 07:57:00 - list reads 03/24/2017 3:57am - actual time 03/24/2017 3:57PM
 
Thanks, Yes, unfortunately I need it to not change when editing. I will look forward to your changes. Thanks!
 
Hmmm. Well, I tested with your settings, and it works fine for me.

Can you point me at the page this is on?

-- hugh
 
I just updated my date.php completely (my line numbers didnt match yours) and tried again and still same result. It must be something funky with my setup.
 
I'll prolly need backend access, so if you want to update your My Sites notes with whatever incantation and ancient ritual magicks I need to get in.

-- hugh
 
I updated my magic tricks in the notes. There is a secret word in the URL and directory protection on the admin directory.
 
I don't know if it's related, but you have a JavaScript error on the page, in this ...

Code:
    jQuery(document).ready( function() {            
        if (window.addEventListener) {
            window.addEventListener('scroll', s5_fm_check_scroll_height, false);
        }           
        else if (window.attachEvent) {
            window.attachEvent('onscroll', s5_fm_check_scroll_height);
        }           
            window.setTimeout(s5_fm_check_scroll_height,100);       
        }   
    );   
    function s5_fm_check_scroll_height() {           
               
    if (window.pageYOffset >= ){           
        document.getElementById("s5_menu_wrap").className = 's5_wrap_fmfullwidth';           
                document.getElementById("subMenusContainer").className = 'subMenusContainer';           
        document.getElementById("s5_floating_menu_spacer").style.height = document.getElementById("s5_menu_wrap").offsetHeight + "px";           
        if (document.getElementById("s5_menu_wrap").parentNode.offsetHeight >= document.getElementById("s5_menu_wrap").offsetHeight - 20 && document.getElementById("s5_menu_wrap").parentNode.parentNode.offsetHeight >= document.getElementById("s5_menu_wrap").    offsetHeight - 20 && document.getElementById("s5_menu_wrap").parentNode.style.position != "absolute" && document.getElementById("s5_menu_wrap").parentNode.parentNode.style.position != "absolute") {           
            document.getElementById("s5_floating_menu_spacer").style.display = "block";           
        }           
    }       
    else {            
        document.getElementById("s5_menu_wrap").className = '';    document.getElementById("subMenusContainer").className = '';            
        document.getElementById("s5_floating_menu_spacer").style.display = "none";           
    }       
    }

... which has a syntax error in the first line of the s5_fm_check_scroll_height function:

Code:
    if (window.pageYOffset >= ){

I've no idea where that script comes from, but I'm guessing it's in your site template.

It's possible having a JS error on load could be messing with Fabrik's init of the date element.

-- hugh
 
hmm., ok , yeah I have no idea what that is or where it came from, has to be the template. I'm not sure what it's looking for there or why its throwing an error.

I think I got rid of it, from what I can tell. I'm gonna try some more tests and see if that was the culprit.

UPDATE: I tried another test. I Don't see the JS error but the date is still displaying as AM even when it should be PM.

For what its worth, the time is actually correct - it's just the am/pm. even tho its diesnt seem to appear correct in the db, it's displaying the correct hour/min.
 
Last edited:
I'm trying to test it, but when I submit the form, it tells me I'm over my limit for whatever account type I choose.

If you change the format to something "normal", like Y-m-d H:i, does it get the time right?

-- hugh
 
Oh right, You wouldnt be able to put in a test account because you are administrator and it is expecting a registered user.

anyway, Yes it does show the right time, the issue is not with the time per se, looks to be just with the am/pm. the time is always right, it was just that it would always say am when it should be pm. so the right time is being input.

So UPDATE: I left the form as Y-m-d H:i and changed the list format to m/d/Y g:ia and it is displaying right now! Did you do something??
 
Nope. Although that was going to be my next suggestion.

I had actually tried that on my test setup, it was the first thing I tried. Setting the form format to a "normal" one, as you aren't displaying it on the form, and the form format affects the way it gets input. But it didn't make any difference on my setup - I could never get it to show the "wrong" suffix. I only ever had that issue with the double-dipping of the TZ offset, that I fixed.

All I can surmise is that it's something to do with PHP versions, as the date formatting is being handled by calls to PHP's DateTime class.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top