1. Fabrik 3.8.1 has been released. It is mostly bug fixes and feature enhancements, but does include two new plugins (push notifications, and the sequence element). As usual we strongly recommend testing the new release on a sandbox if your application is mission critical, and always do an Akeeba backup before updating.

using 'today' as a filter pre-fill

Discussion in 'Professional Support' started by skyrun, Jan 11, 2018.

  1. skyrun

    skyrun Active Member

    Level: Professional
    i am using this url to show a fabrik list with prefilled filters.

    https://testlocation.skyrun.com/sky...eservations___Arrival_Date[condition]=BETWEEN

    i use 'today' because it's on a menu item for 'Today's Arrivals'. (that's my use-case for wanting 'today' to work, so i can have a menu item that pre-fills in todays date). i would like for 'today' to be based on joomla's timezone setting for the joomla it's running on. however it seems as if fabrik interprets 'today' as UTC/GMT today.

    this behaviour seems to have changed in the last 2-3 months (my users report... i hadn't noticed). it changed so that when they use the link above it shows the day at UTC. Meaning at 5pm MT, it switches to showing tomorrow. (ie a day that won't arrive here for 7 more hours). Does this no matter the joomla tz setting, server/linux tz setting or mysql db tz setting (which are all mountain time).

    i know 'today' was supported in v2 fabrik, but i think not initially in v3 fabrik. perhaps someone added support, but is using php's gmdate vs. date? i can see using gmdate if the date element being interpreted has 'UTC' selected, but i have selected 'local time' for my date element, so i would want 'today' to be the current day for the tz joomla it's running on.

    perhaps this article helps: https://compojoom.com/blog/entry/how-to-use-jdate

    * i have joomla/fabrik sites running in 5 different time zones on my server, so we must use the joomla timezone which is set for each vs. the 'server timezone' for storing our dates.
     
    Last edited: Jan 11, 2018
  2. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Professional
    I added a fix for that last year:

    https://github.com/Fabrik/fabrik/co...e59ac98#diff-e1cb000e1bb03745cbb4528d3393f497

    ... although it looks like I moofed 'today' and added an extra convert, which I just fixed:

    https://github.com/Fabrik/fabrik/co...ae74d4f#diff-e1cb000e1bb03745cbb4528d3393f497

    But also ... you are using the wrong query string. Don't do "between today and today", just do ...

    https://testlocation.skyrun.com/sky...eservations___Arrival_Date[condition]=BETWEEN

    ... which yields a query like this:

    Code (Text):

    WHERE ( (CONVERT_TZ(`fab_date_test`.`normal_date`, "+0:00", "-06:00") >= CURDATE() AND CONVERT_TZ(`fab_date_test`.`normal_date`, "+0:00", "-06:00") < CURDATE() + INTERVAL 1 DAY) )
     
    Well, after that github fix. :)

    Nope, doesn't help, as we don't support per-user timezones. That's something I'm looking at for 4.0, with a complete rewrite of the date element.

    -- hugh
     
  3. skyrun

    skyrun Active Member

    Level: Professional
    for my needs, i'm looking for a per joomla-instance tz (in case that helps). but yes, joomla users can override with their own tzs, but i don't need to support that.

    note that your suggested url gives a 500 error:

    https://testlocation.skyrun.com/sky...eservations___Arrival_Date[condition]=BETWEEN

    i have to include the 'today' in there for it to work.

    i'll test it tonight at 5pm to see if it sticks to 'today'. note that i would like between today and month +1 month to work also with my 'next months arrivals' menu item.
     
  4. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Professional
    Oh, my bad, I meant TODAY not BETWEEN. That's what generates the query I pasted.

    Hugh


    Sent from my HTC6545LVW using Tapatalk
     

Share This Page