If you have a specific set of dates that you have saved in an array and want to compare them with today’s date using Liquid Script, please refer to the below-mentioned steps to get an idea of how this could be achieved. Remember, you can always modify the code according to your preferences by going through the Liquid Help guides created by Shopify.


  • First, we assign a string, which contains all the dates, to a variable ‘y’ and Split the string using the delimiter “,”
  • Split function is used to split a string into multiple items present in an array. So, each date will be split at the ”,” delimiter and will be saved as an individual date in the array.
  • Next, we capture and assign the value of the current date to the variable "value".
  • ‘Capture’ is used to assign the values that are written in-between the capture tags, and are stored as a ’String’. Click here for more details.
  • We start a “for loop” for a variable ‘i’ in the array ‘y’ which contains all the dates as individual items in an array.
  • Next, we capture the values present in the array one by one, and compare each value with the corresponding ‘now’ date
  • According to the script (which can be modified), whenever the ‘now’ date equals the Value in the array, the “for loop” will break and print the values captured before the break.
  • End of “for loop”


{% assign y = "2017-09-23,2017-10-04,2017-09-18,2017-12-18,2017-09-20" | split: "," %}

{% capture value %}

{{"now" | date: "%Y-%m-%d " }}

{% endcapture %}

{% for i in y %}

{% capture test %}{{ i | | date: "%Y-%m-%d " }}{% endcapture %}

{% capture test2 %}{{ value | | date: "%Y-%m-%d " }}{% endcapture %}

{% if test == test2 %}

{% break %}

{% else %}


{% endif %}

{% endfor %}