Summary

Show a message “Publish Me” when a date (Id: embargoDate) on a Layer (Id: corporateInformation) is today or before today.

{% assign today_date = 'now' | date: '%s' %} 
{% assign embargo_date = data.corporateInformation.embargoDate | local_date %} 

{% if today_date => embargo_date %} 
Embargo lifted! Publish Me! 
{% endif %} 
CODE

Setup in Picturepark

  • Layer "Corporate Information"

  • The date time field "Embargo date"

Field Value Access

To use the date-time value in the display pattern, you must convert it by passing the liquid filter local_date. Local date uses the timezone of the regional settings of my client laptop or alike.

data.corporateInformation.embargoDate | local_date

Use Case

A valid use case is to check if the embargo date is passed and the content can be published:

{% assign today_date = 'now' | date: '%s' %} 
{% assign embargo_date = data.corporateInformation.embargoDate | local_date %} 

{% if today_date => embargo_date %} 
Embargo lifted! Publish Me! 
{% endif %} 
JSON