CMS Development

Anton
名誉エキスパート | Diamond Partner
名誉エキスパート | Diamond Partner

Show HubDB entries till today

解決

Hi, 

a few weeks ago I've started this topic in which I've needed to add some "filter" to a module.

@tjoyce done a great job by helping me with it.

 

Now I need to add a constant "show entries, which has a expiry date till *today*". There is a Hub DB Column with a date entry which should work as the filter entry.

 

e.g

- Row1 has an expiry date of 12.09.2018(will be shown in the module)

- Row2 has an expiry date of 10.09.2018(won't be shown in the module, because the expiry date was yesterday)

....

 

I've found this topic and modified the solution for my needs. Unfortunately it doesn't work. 

 

 {% if (row['expiryDate']|datetimeformat('%Y-%m-%j')) >= (local_dt|datetimeformat('%Y-%m-%j')) %}
*LISTING*
{% endif %}

expiryDate = HubDB column name of the datepicker

datetimeformat '%Y-%m-%j' = the format how the HubDB table export(CSV/XLS) looks like.

 

I've also tried to change the local_dt|datetimeformat to the datetimeformat which is set in the HubSpot settings(it's set to "Germany" and the blog settings are set to "medium")...

 

What am I doing wrong?

 

 

regards

Anton

Anton Bujanowski Signature
0 いいね!
1件の承認済みベストアンサー
tjoyce
解決策
名誉エキスパート | Elite Partner
名誉エキスパート | Elite Partner

Show HubDB entries till today

解決

Hey @Anton - I don't use HubDB a whole lot but, I thought dates were converted to Unix timestamps in your database record...

 

What is the output of 

row['expiryDate']

does it look something like this? 1536665594000

If it does, then you can do this:

 {% if (row['expiryDate'] >= unixtimestamp(local_dt) %}
    *LISTING*
 {% endif %}

If it doesn't, you may be able to do this:

 

 {% if (unixtimestamp(row['expiryDate']) >= unixtimestamp(local_dt) %}
    *LISTING*
 {% endif %}

 


If this answer helped, please, mark as solved 😄


tim@belch.io | forms.belch.io | Design your own Beautiful HubSpot Forms; No coding necessary.

 

Drop by and say Hi to me on slack.

元の投稿で解決策を見る

3件の返信
tjoyce
解決策
名誉エキスパート | Elite Partner
名誉エキスパート | Elite Partner

Show HubDB entries till today

解決

Hey @Anton - I don't use HubDB a whole lot but, I thought dates were converted to Unix timestamps in your database record...

 

What is the output of 

row['expiryDate']

does it look something like this? 1536665594000

If it does, then you can do this:

 {% if (row['expiryDate'] >= unixtimestamp(local_dt) %}
    *LISTING*
 {% endif %}

If it doesn't, you may be able to do this:

 

 {% if (unixtimestamp(row['expiryDate']) >= unixtimestamp(local_dt) %}
    *LISTING*
 {% endif %}

 


If this answer helped, please, mark as solved 😄


tim@belch.io | forms.belch.io | Design your own Beautiful HubSpot Forms; No coding necessary.

 

Drop by and say Hi to me on slack.

Anton
名誉エキスパート | Diamond Partner
名誉エキスパート | Diamond Partner

Show HubDB entries till today

解決

@tjoyce

thanks for the support!

I've tested the output with 

{{ row['expiryDate'] | pprint }}

but the only thing I've saw was "null" いらだったスマイリー

 

After some deeper resarch, your "idea" with the unixtimestamp", some testing, more research and testing again I've found the solution which worked

 

{% if (row['expiryDate']|unixtimestamp) >= (local_dt|unixtimestamp - 28800000) %}
*LISTING*
{% endif %}

Thanks again man!

 

regards

Anton Bujanowski Signature
tjoyce
名誉エキスパート | Elite Partner
名誉エキスパート | Elite Partner

Show HubDB entries till today

解決

Awesome @Anton - glad you got it working.

0 いいね!