Support

Home Forums Event Espresso Premium Shortcode used for filtering month and category returning one wrong record.

Shortcode used for filtering month and category returning one wrong record.

Posted: December 30, 2021 at 1:28 am


Alaska Tactical

December 30, 2021 at 1:28 am

My shortcode is [ESPRESSO_EVENTS category_slug=”foundation-handgun-carbine-shotgun” , month=”August 2022″] and its returning one event from this category which has the date August 19,2022 and another event from the same category which has the date July 29,2022.Kindly help me solve this.


Tony

  • Support Staff

December 30, 2021 at 5:17 am

Hi there,

Can you link me to the page in question so I can take a look at this, please?


Alaska Tactical

December 30, 2021 at 6:13 am

https://alaskatactical.com/schedule/ this is the page link. You have to choose Handgun,carbine & shortgun – stage 1 from the Category dropdown and from Month dropdown choose August 2022


Tony

  • Support Staff

December 30, 2021 at 7:20 am

Hmm, ok, so it looks like the issue here is due to timezones.

EE stores datetimes in UTC but your UTC-8 (correct?), so the Datetime is saved like this:

"DTT_EVT_start": "2022-07-29T18:00:00",
"DTT_EVT_end": "2022-07-31T17:00:00",
...
"DTT_EVT_start_gmt": "2022-07-30T02:00:00",
"DTT_EVT_end_gmt": "2022-08-01T01:00:00",

(_gmt are the ‘raw values’ and then EE uses those with your sites offsite for all other DateTime outputs)

The query for month uses:

$SQL = " AND {$datetime_table}.DTT_EVT_start <= '";
$SQL .= date('Y-m-t 23:59:59', EEH_DTT_Helper::first_of_month_timestamp($month)) . "'";
// event end date is GREATER than the start of the month ( so nothing that ended before this month )
$SQL .= " AND {$datetime_table}.DTT_EVT_end >= '";
$SQL .= date('Y-m-01 0:0:00', EEH_DTT_Helper::first_of_month_timestamp($month)) . "' ";

For that July event the value is stored as:

DTT_EVT_end_gmt": "2022-08-01T01:00:00"

So it’s pulled into that query.

I don’t have a solution you can use to fix this as is but will create a ticket for our developers to investigate this further.


Alaska Tactical

December 30, 2021 at 10:01 pm

Thank you for letting me know the actual cause of this problem.

The support post ‘Shortcode used for filtering month and category returning one wrong record.’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso