> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ordergroove.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ordergroove.com/_mcp/server.

# Working with Dates in the Subscription Manager

The Subscription Manager exposes several helper functions that make it easy to display and calculate dates.

## Formatting Dates

In Liquid files, you can use the `date` [filter](/docs/lifecycle/sm/dev-guide#filters-and-pipes) to format a date string (e.g. `"2025-02-16"`) for display:

```liquid
<h1>Subscription Start Date: {{ subscription.start_date | date }}</h1>
```

This will display "Subscription Start Date: February 16, 2025".

To specify how the date is formatted, pass a format string. The `date` filter uses [dayjs](https://day.js.org/en/) to parse and format dates — refer to their documentation for [available formats](https://day.js.org/docs/en/display/format). For example:

```liquid
<p> {{ subscription.start_date | date('YYYY-MM-DD') }} - will display 2025-02-16</p>
<p> {{ subscription.start_date | date('MMM D, YYYY') }} - will display Feb 16, 2025</p>
```

## Computing Dates

You can also use the dayjs library in the Subscription Manager to manipulate date values, without having to perform date computations yourself.

For example, to calculate a date 15 days after the subscription start date, add this function to your `script.js`:

```javascript
function get15DaysAfterSubscriptionStart(subscription) {
  return typeof dayjs === 'function' ? dayjs(subscription.start_date).add(15, 'day') : null;
}
```

Then display it in a Liquid file:

```liquid
{% set expiry_date = 'get15DaysAfterSubscriptionStart(subscription)' | js %}
<p>{{ expiry_date | date }}</p>
```

Refer to the [dayjs docs](https://day.js.org/docs/en/manipulate/manipulate) for the available manipulation methods.