La fonction de suggestion automatique permet d'affiner rapidement votre recherche en suggérant des correspondances possibles au fur et à mesure de la frappe.
I have created a table in hubDB to track press releases, and a listing page to display them.
The listing page filters by comparing the date in the table item (item.date|unixtimestamp) to the local time (local_dt|unixtimestamp). As far as I can tell, the local_dt is adjusting for BST, but the item.date from HubDB is not.
Is this correct, and does anyone know of work around ?
We recently were working through a similar issue where datetimes set in hubdb were being set in the content administrators time (CDT/CST), and we needed a way to shift those times into the correct local timezone, as though they were set in the correct timezone to begin with. We settled on parsing out the timezone offset from the local_dt (which changes during the course of the year), and then using that in computing the datetimes for display purposes.
You can see how that works with the code below
"my_time" should be the timestamp you get from hubdb. In order for this code to run, I'm just using the local_dt. {% set my_time = unixtimestamp(local_dt) %}
Get the offset value for the local dt:
{% set offset = datetimeformat(local_dt, '%z') %}
Convert the offset value for the local dt a numerical representation of "hours to be added to a unix timestamp", eg 5.0
{% set offset_num = (((offset|float) / 100) * -1) %}
Convert those hours into milliseconds and back into integer to avoid floating point errors.
{% set offset_millis = (offset_num * 60 * 60 * 1000)|int %}
Values for debugging:
{{my_time}}
{{offset}}
{{offset_num}}
{{offset_millis}}
Final shifted value (in milliseconds):
{{my_time+offset_millis}}
Is your date and time localized? Check out the HubL variables, there are a lot of different options for date and time, like this:
{{ content.publish_date_localized }}
string
A string representing the datetime when the content was published, in the local time as defined in the HubSpot Report settings. This variable is also subject to the language and dateformat settings in Content Settings > Blog.
After some digging I think my issue is that the |unixtimestamp filter is not doing what I expected it to do. I should adjust the timezone of the local_dt before filtering it.