Liquid Date tricks

Sometimes you need to get the current date in a specific format.
You might need to send a start_date that is always in 1 day in te future.
How would we create this in Liquid? Let's show some examples:

Add days to current date

In the following snippet '5' is what represents five days.

{% assign seconds = 5 | times: 24 | times: 60 | times: 60 %}
{{ 'now' | date: "%s" | plus: seconds | date: "%Y-%m-%d" }}

Add days to an existing date

In the following snippet "10" is what represents five days.

{% assign existing_date = '2023-12-31' | date: '%s' %}
{% assign seconds = 10 | times: 24 | times: 60 | times: 60 %}
{{ existing_date | date: "%s" | plus: seconds | date: "%Y-%m-%d" }}

So the result is existing date plus 10 days.