Comparing Datetime Liquid Logic Error

New Member
1 0 0

Hiya all, so I'm making a little redirect given that a customer doesn't have an active subscription-based upon a one day time requirement but every time the page loads, it seems to redirect anyway. expirationDate is the Order created_at plus 1 day.

 

expirationDate: January 29, 2020 05:12PM

today_date: January 28, 2020 06:49PM

 

{% assign ordercreatedat = order.created_at %}
{% capture expirationDate %} {{ ordercreatedat | date: '%s' | plus: 86400 | date: '%B %d, %Y %I:%M%p' }} {% endcapture %}
 {% assign today_date = 'now' | date: '%B %d, %Y %I:%M%p' %}
        <p>{{ expirationDate }}
        <p>{{ today_date }}
    {% if expirationDate < today_date %}
       <script>
         window.location = "http://google.com"
       </script>
   	{% else %}
  		<div class="rte">
    	{{ page.content }}
  		</div>
{% endif %}
0 Likes