Where is "widget.publish_end_date" coming from? if you are referencing a custom module you set up on the post page to hold an manually inserted end date for an event then you are not referencing it correctly. It would be "widget_data.publish_end_date.value" .value being the value holder for a text field, .html for richtext, etc.
I would check the output of both date types that you are checking. They both need to be integers in order for you to compare them by size. If both dates correctly referenced, and are correctly converted to integers then comparing their size will do what you need.
Here is the definition of Unix time time in Wikipedia.
basically it's the number of seconds between 00:00:00 1 January 1970 and a given date, in your case you want the number of seconds between that date and your two dates to compare. convert both to unix time.
Does widget.publish_end_date ouput anything? that seams wierd to me. If you click the sprocket in the to right corner on a page using this template and view developer info fomr the list you will be taken to a page that looks a little like view source. you can use ctrl +f to search for "publish_end_date" and you will find the data for that module which you can use to build the token.
Where is "widget.publish_end_date" coming from? if you are referencing a custom module you set up on the post page to hold an manually inserted end date for an event then you are not referencing it correctly. It would be "widget_data.publish_end_date.value" .value being the value holder for a text field, .html for richtext, etc.
I would check the output of both date types that you are checking. They both need to be integers in order for you to compare them by size. If both dates correctly referenced, and are correctly converted to integers then comparing their size will do what you need.
The "widget.publish_end_date" is a field from a module with the type text with a content of "27.10.2017" as an example. I tried "widget_data.publish_end_date.value" but this is empty.
I understand what you mean but with which method I can convert to integer? 2With "|int" or with "unixtimestamp()" or so?
Here is the definition of Unix time time in Wikipedia.
basically it's the number of seconds between 00:00:00 1 January 1970 and a given date, in your case you want the number of seconds between that date and your two dates to compare. convert both to unix time.
Does widget.publish_end_date ouput anything? that seams wierd to me. If you click the sprocket in the to right corner on a page using this template and view developer info fomr the list you will be taken to a page that looks a little like view source. you can use ctrl +f to search for "publish_end_date" and you will find the data for that module which you can use to build the token.
{% set publish_date_data = widget_data.publish_end_date.value|datetimeformat('%d.%m.%Y') %} {% set publish_date = unixtimestamp(publish_date_data) %} {% set current_date = unixtimestamp(local_dt) %}
{% if publish_date >= current_date %}
... {% endif %}
To your questions: - Yes, "widget_data.publish_end_date.value" gives me "20.10.2017" back because "widget.publish_end_date" its a text field and I typed in that. - So I wanted to make a datetimeformat out of it. That runs well. The outpout of publish_date_data is "20.10.2017".
But then the second line where I want to calculate the unixtimestamp out of it to compare with the unixtimestamp of "local_dt" gives me that Error back "TemplateSyntaxException: Error invoking function 'unixtimestamp'".