{"id":1028773,"date":"2015-11-20T14:16:02","date_gmt":"2015-11-20T22:16:02","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/previousnext-link-issue-with-timezone\/"},"modified":"2016-02-18T08:31:50","modified_gmt":"2016-02-18T16:31:50","slug":"previousnext-link-issue-with-timezone","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/previousnext-link-issue-with-timezone\/","title":{"rendered":"Previous\/Next Link issue with timezone"},"content":{"rendered":"<p>Hello, I hope you are doing well.<\/p>\n<p>I had an issue with the previous event link on my website, the issue was that the previous link was &#8220;looping&#8221; between two events from the same day. I found out how to fix it but I wanted to let you know so you can investigate.<\/p>\n<p>&#8211; The WordPress timezone is set to Los Angeles<br \/>\n&#8211; Function: get_event_link() in Tribe\/Main.php<br \/>\n&#8211; $post-&gt;EventStartDate is set to &#8220;2015-12-02 23:00:00&#8221;<br \/>\n&#8211; in the DB, _EventStartDate is set to &#8220;2015-12-02 15:00:00&#8221;<br \/>\n&#8211; in the DB, _EventStartDateUTC is set to &#8220;2015-12-02 23:00:00&#8221;<\/p>\n<p>The issue is that the query needs to compare $post-&gt;EventStartDate with  _EventStartDateUTC and not _EventStartDate. I fixed the issue by changing to following code:<\/p>\n<p><code><br \/>\n$args = array(<br \/>\n\t'post__not_in'   =&gt; array( $post-&gt;ID ),<br \/>\n\t'order'          =&gt; $order,<br \/>\n\t'orderby'        =&gt; \"TIMESTAMP( $wpdb-&gt;postmeta.meta_value ) ID\",<br \/>\n\t'posts_per_page' =&gt; 1,<br \/>\n\t'meta_query'     =&gt; array(<br \/>\n\t\tarray(<br \/>\n\t\t\t'key'     =&gt; '_EventStartDateUTC',<br \/>\n\t\t\t'value'   =&gt; $post-&gt;EventStartDate,<br \/>\n\t\t\t'type'    =&gt; 'DATETIME',<br \/>\n\t\t\t'compare' =&gt; $direction,<br \/>\n\t\t),<br \/>\n\t\tarray(<br \/>\n\t\t\t'key'     =&gt; '_EventHideFromUpcoming',<br \/>\n\t\t\t'compare' =&gt; 'NOT EXISTS',<br \/>\n\t\t),<br \/>\n\t\t'relation'    =&gt; 'AND',<br \/>\n\t),<br \/>\n);<br \/>\n<\/code><\/p>\n<p>Let me know if it helps.<\/p>\n<p>Thank you,<br \/>\nMatt<\/p>\n","protected":false},"template":"","class_list":["post-1028773","topic","type-topic","status-closed","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Previous\/Next Link issue with timezone -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/previousnext-link-issue-with-timezone\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Previous\/Next Link issue with timezone -\" \/>\n<meta property=\"og:description\" content=\"Hello, I hope you are doing well. I had an issue with the previous event link on my website, the issue was that the previous link was &#8220;looping&#8221; between two events from the same day. I found out how to fix it but I wanted to let you know so you can investigate. &#8211; The [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/previousnext-link-issue-with-timezone\/\" \/>\n<meta property=\"article:modified_time\" content=\"2016-02-18T16:31:50+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/previousnext-link-issue-with-timezone\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/previousnext-link-issue-with-timezone\/\",\"name\":\"Previous\/Next Link issue with timezone -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2015-11-20T22:16:02+00:00\",\"dateModified\":\"2016-02-18T16:31:50+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/previousnext-link-issue-with-timezone\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/previousnext-link-issue-with-timezone\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/previousnext-link-issue-with-timezone\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/theeventscalendar.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\/\/theeventscalendar.com\/support\/topics\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Ticket Products\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/event-tickets\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Community Tickets\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/event-tickets\/community-tickets\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Previous\/Next Link issue with timezone\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\",\"url\":\"https:\/\/theeventscalendar.com\/support\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Previous\/Next Link issue with timezone -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/previousnext-link-issue-with-timezone\/","og_locale":"en_US","og_type":"article","og_title":"Previous\/Next Link issue with timezone -","og_description":"Hello, I hope you are doing well. I had an issue with the previous event link on my website, the issue was that the previous link was &#8220;looping&#8221; between two events from the same day. I found out how to fix it but I wanted to let you know so you can investigate. &#8211; The [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/previousnext-link-issue-with-timezone\/","article_modified_time":"2016-02-18T16:31:50+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/previousnext-link-issue-with-timezone\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/previousnext-link-issue-with-timezone\/","name":"Previous\/Next Link issue with timezone -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2015-11-20T22:16:02+00:00","dateModified":"2016-02-18T16:31:50+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/previousnext-link-issue-with-timezone\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/previousnext-link-issue-with-timezone\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/previousnext-link-issue-with-timezone\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/theeventscalendar.com\/support\/"},{"@type":"ListItem","position":2,"name":"Topics","item":"https:\/\/theeventscalendar.com\/support\/topics\/"},{"@type":"ListItem","position":3,"name":"Ticket Products","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/event-tickets\/"},{"@type":"ListItem","position":4,"name":"Community Tickets","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/event-tickets\/community-tickets\/"},{"@type":"ListItem","position":5,"name":"Previous\/Next Link issue with timezone"}]},{"@type":"WebSite","@id":"https:\/\/theeventscalendar.com\/support\/#website","url":"https:\/\/theeventscalendar.com\/support\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1028773","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1028773\/revisions"}],"predecessor-version":[{"id":1029637,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1028773\/revisions\/1029637"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1028773"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}