Skip to content

Instantly share code, notes, and snippets.

@katyayu
Last active Oct 13, 2017
Embed
What would you like to do?
{% if settings.badge_toggle and settings.new_products_period.size > 0 %}
{% comment %}Is this product new?{% endcomment %}
{% assign date_pub_y = product.published_at | date:'%Y' %}
{% assign date_pub_d = product.published_at | date:'%j' %}
{% assign date_now_y = 'now' | date:'%Y' %}
{% assign date_now_d = 'now' | date:'%j' %}
{% assign dates_diff_y = date_now_y | minus: date_pub_y | times: 365 %}
{% assign dates_diff_d = date_now_d | minus: date_pub_d %}
{% assign dates_diff = dates_diff_y | plus: dates_diff_d %}
{% assign new_products_period = settings.new_products_period | plus: 0 %}
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment