Copy and paste directly from the documentation example:
{{ '2015-09-26' | parse_date }}Result: Renders nothing in wagon and engine
It's unclear from the documentation how the format option is supposed to be used. Based on the money filter options, I tried:
{{ '2015-09-26' | parse_date: format: '%m/%d/%Y' }}Result: error message - "no implicit conversion of Hash into String" (wagon and engine)
I found this GitHub issue where parse_date is mentioned and the example given is:
{% assign date_a = "2015-11-01" | parse_date: '%Y-%m-%d' %}
This appears to be more acurate than the documentation.
The following snippet works in both wagon and engine:
{% assign myDate = '08-28-2023' | parse_date: '%m-%d-%Y' %}
{% if now > myDate %}
today comes after myDate
{% else %}
today comes before myDate
{% endif %}
Note the American date format mm-dd-yyyy. This is how I know that the parse_date filter is working here. If I run the same snippet without the parse_date filter, I get an error message - "comparison of ActiveSupport::TimeWithZone with String failed".
It seems to me that parse_date is intended for use in Liquid tags, not objects, i.e. with {% and %} delimiters, not {{ and }}.
The title says it all. I'm reluctant to suggest updates to the documention until I get some feedback about the intended use of this filter.
Documentation: https://doc.locomotivecms.com/docs/filters#parse_date
Copy and paste directly from the documentation example:
{{ '2015-09-26' | parse_date }}
Result: Renders nothing in wagon and engineIt's unclear from the documentation how the
format
option is supposed to be used. Based on themoney
filter options, I tried:{{ '2015-09-26' | parse_date: format: '%m/%d/%Y' }}
Result: error message - "no implicit conversion of Hash into String" (wagon and engine)I found this GitHub issue where parse_date is mentioned and the example given is:
{% assign date_a = "2015-11-01" | parse_date: '%Y-%m-%d' %}
This appears to be more acurate than the documentation. The following snippet works in both wagon and engine:
Note the American date format mm-dd-yyyy. This is how I know that the
parse_date
filter is working here. If I run the same snippet without theparse_date
filter, I get an error message - "comparison of ActiveSupport::TimeWithZone with String failed".It seems to me that
parse_date
is intended for use in Liquid tags, not objects, i.e. with{%
and%}
delimiters, not{{
and}}
.