Library of Liquid Snippets

Cast.app uses Liquid to personalize visualizations and narrations. Here is a library of Liquid snippets you can use in your projects.

Contents

Handling Null Values in Variables

Use the default filter to set a default value to a variable to catch nulls or invalid values.

{{ this-variable-may-be-null | default: "" }}


{% assign pn = private_notes | default: "" %}
{% if pn == "INAPPDEMO" %}
	Setting up cast.app presentations to show in your app is easy.
{% endif %}

Convert a variable of type string to type number

Multiplying a variable by 1 using the times filter will convert a variable to a number.

{{ count-of-CSMs | times: 1 }}

Customer Since Snippet

Use the Customer Since snippet to return how long someone has been a customer with your company. This snippet is best used in the narration of your Welcome slide to personalize the greeting and thank them for being a customer.

You will pass in a date value using a Cast field to the dateStart variable in the snippet.

{% comment %} Snippet Name: CustomerSince {% endcomment %}
{% comment %} Input date customer started in dateStart {% endcomment %}
{% comment %} Output: 1 year and 6 days {% endcomment %}

{% comment %} For "2022/01/12" Output: 1 year and 6 days {% endcomment %}
{% comment %} For "2024/1/1" Output: 348 days in the future {% endcomment %}
{% comment %} For "2023/1/1" Output: 2 weeks and 3 days {% endcomment %}
{% comment %} For "2022/7/11" Output: 6 months and 1 week {% endcomment %}
{% comment %} For "2021/4/17" Output: 1 year and 9 months {% endcomment %}



{% assign dateStart = "2021/4/17" %}

{% assign dateStart = dateStart | date: '%s'%}
{% if dateStart != '-2208988800' and dateStart !='' and dateStart != null%}

    {% assign nowTimestamp = 'now' | date: '%s' %}

    {% comment %} difference in seconds {% endcomment %}
    {% assign diffSeconds = nowTimestamp | minus: dateStart %}

    {% assign diffDays = diffSeconds | divided_by: 3600 | divided_by: 24 %}

    {% comment %} years, months, weeks, and days calculation {% endcomment %}
    {% if diffDays >= 365 %}
        {% assign years = diffDays|divided_by:365%}
        {% assign yearsRemainder = diffDays| modulo:365%}

        {% if years >1 %}
            {% capture years %}{{years}} years{% endcapture %}
        {% else %}
            {% capture years %}{{years}} year{% endcapture %}
        {% endif %}

        {% assign timeFrame = years %}

        {% if yearsRemainder >= 30 %}
            {% assign months = yearsRemainder|divided_by:30%}
            {% assign monthsRemainder = yearsRemainder| modulo:30%}

            {% if months >1 %}
                {% capture months %}{{months}} months{% endcapture %}
            {% else %}
                {% capture months %}{{months}} month{% endcapture %}
            {% endif %}

            {% capture timeFrame%}{{years}} and {{months}}{% endcapture %}


        {% elsif yearsRemainder >=7 and yearsRemainder < 30 %}

            {% assign weeks = yearsRemainder|divided_by:7 %}
            {% assign weeksRemainder = yearsRemainder|modulo:7 %}

            {% if weeks >1 %}
                {% capture weeks %}{{weeks}} weeks{% endcapture %}
            {% else %}
                {% capture weeks %}{{weeks}} week{% endcapture %}
            {% endif %}

            {% capture timeFrame %}{{years}} and {{weeks}}{% endcapture %}


        {% elsif yearsRemainder > 0 and yearsRemainder <7 %}

            {% assign days = yearsRemainder %}

            {% if days >1 %}
                {% capture days %}{{days}} days{% endcapture %}
            {% else %}
                {% capture days %}{{days}} day{% endcapture %}
            {% endif %}

            {% capture timeFrame %}{{years}} and {{days}}{% endcapture %}

        {% endif %}

    {% endif %}

    {% comment %} months, weeks, and days calculation {% endcomment %}
    {% if diffDays >=30 and diffDays < 365 %}

        {% assign months = diffDays|divided_by:30%}
        {% assign monthsRemainder = diffDays| modulo:30%}

        {% if months >1 %}
            {% capture months %}{{months}} months{% endcapture %}
        {% else %}
            {% capture months %}{{months}} month{% endcapture %}
        {% endif %}

        {% assign timeFrame = months %}

        {% if monthsRemainder >= 7 %}
            {% assign weeks = monthsRemainder|divided_by:7 %}
            {% assign weeksRemainder = monthsRemainder|modulo:7 %}

            {% if weeks >1 %}
                {% capture weeks %}{{weeks}} weeks{% endcapture %}
            {% else %}
                {% capture weeks %}{{weeks}} week{% endcapture %}
            {% endif %}

            {% capture timeFrame %}{{months}} and {{weeks}}{% endcapture %}

        {% elsif monthsRemainder > 0 and monthsRemainder < 7 %}

            {% assign days = monthsRemainder %}

                {% if days >1 %}
                    {% capture days %}{{days}} days{% endcapture %}
                {% else %}
                    {% capture days %}{{days}} day{% endcapture %}
                {% endif %}

                {% capture timeFrame %}{{months}} and {{days}}{% endcapture %}

        {% endif %}

    {%endif%}

    {% comment %} weeks and days calculation {% endcomment %}
    {% if diffDays >=7 and diffDays < 30 %}

        {% assign weeks = diffDays|divided_by:7 %}
        {% assign weeksRemainder = diffDays|modulo:7 %}

        {% if weeks >1 %}
            {% capture weeks %}{{weeks}} weeks{% endcapture %}
        {% else %}
            {% capture weeks %}{{weeks}} week{% endcapture %}
        {% endif %}

        {% assign timeFrame = weeks %}

        {% if weeksRemainder > 0 %}
            {% assign days = weeksRemainder %}

            {% if days >1 %}
                {% capture days %}{{days}} days{% endcapture %}
            {% else %}
                {% capture days %}{{days}} day{% endcapture %}
            {% endif %}

            {% capture timeFrame %}{{weeks}} and {{days}}{% endcapture %}
        {% endif %}

    {%endif%}

    {% comment %} days calculation {% endcomment %}
    {% if diffDays >=0 and diffDays < 7 %}

        {% assign days = diffDays %}

        {% if days >1 or days ==0 %}
            {% capture days %}{{days}} days{% endcapture %}
        {% else %}
            {% capture days %}{{days}} day{% endcapture %}
        {% endif %}

        {% assign timeFrame = days%}
    {%endif%}

    {% comment %} in future? {% endcomment %}
    {% if diffDays < 0 %}

        {% assign days = diffDays | abs %}

        {% if days >1 or days ==0 %}
            {% capture days %}{{days}} days in the future{% endcapture %}
        {% else %}
            {% capture days %}{{days}} day in the future{% endcapture %}
        {% endif %}

        {% assign timeFrame = days%}
    {%endif%}

{% else %}

{% assign timeFrame ='Invalid Date Value'%}

{% endif%}

{{timeFrame}}

Using the CustomerSince snippet in a narration.

Personalizing Email Subject

Use the Personalized Email Subject snippet to create a personalized email subject when you send a Cast email. A personalized email subject makes your emails more likely to be opened by your customers because it contains a specific metric or topic the individual would be interested in.

This snippet will display one of the 3 usage metrics from Cast fields (ActiveLearnersTotal, LearningHoursTotal, CourseCompletedTotal) in the email subject based on the criteria of how long the contact has been a customer. Copy and modify the snippet below using your own fields and criteria.

You would enter the snippet name in the Email Subject text box in the Compose Email section of your campaign.


{% comment %}
	Snippet Name:  EmailSubject
    Replace fields customerstartdate, ActiveLearnersTotal, LearningHoursTotal, and CoursesCompletedTotal with your own fields.
{% endcomment %}

{% assign customerstartdateinsecs = customerstartdate | default:"1970-01-01 00:00:00 UTC"|date: '%s' %}
{% assign nowTimestamp = 'now' | date: '%s' %}
{% assign ActiveLearnersTotal = ActiveLearnersTotal|default:0%}
{% assign LearningHoursTotal = LearningHoursTotal|default:0%}
{% assign CoursesCompletedTotal = LearningHoursTotal|default:0%}


{% comment %} Difference in seconds {% endcomment %}
{% assign diffSeconds = nowTimestamp | minus: customerstartdateinsecs %}

{% assign diffDays = diffSeconds | divided_by: 3600 | divided_by: 24 %}

{% if diffDays <= 60%}

    {{contact_name}}, {{ActiveLearnersTotal}} active learner
    {%- if ActiveLearnersTotal != "1" %}s {% endif -%}
    spent {{LearningHoursTotal}} hour
    {%- if LearningHoursTotal != "1" %}s {% endif -%}
    learning in the last 30 days

{%elsif diffDays > 273%}

    {% comment %} Greater than 9 months {% endcomment %}

    {{contact_name}}, {{ActiveLearnersTotal}} active learner
    {%- if ActiveLearnersTotal != "1" %}s {% endif -%}
    completed {{CoursesCompletedTotal}} course
    {%- if CoursesCompletedTotal != "1" %}s {% endif -%}
    in the last 30 days

{%else%}

    {% comment %} Between 60 and 9 months {% endcomment %}
    {{contact_name}}, active learners spent {{LearningHoursTotal}} hour
    {%- if LearningHoursTotal != "1" %}s {% endif -%}
    learning in the last 30 days

{% endif %}

Personalizing Email Body

Use the Personalized Email Body snippet to provide personalized content in your Cast email for each contact. Personalized content will contain targeted topics that your cusotmer will be interested in learning about that would make them more likely to play the cast.

This snippet will return a salutation and one of the 3 usage metrics from Cast fields (ActiveLearnersTotal, LearningHoursTotal, CourseCompletedTotal) based on the criteria of how long the contact has been a customer. Copy and modify the snippet below using your own fields and criteria.

You would enter the snippet name in the Email Body text box in the Compose Email section of your campaign.


{% comment %}
	Snippet Name:  EmailBody
    Replace fields customerstartdate, ActiveLearnersTotal, LearningHoursTotal, and CoursesCompletedTotal with your own fields.
{% endcomment %}

{% assign customerstartdateinsecs = customerstartdate | default:"1970-01-01 00:00:00 UTC"|date: '%s' %}
{% assign nowTimestamp = 'now' | date: '%s' %}

{% comment %} difference in seconds {% endcomment %}
{% assign diffSeconds = nowTimestamp | minus: customerstartdateinsecs %}

{% assign diffDays = diffSeconds | divided_by: 3600 | divided_by: 24 %}

We hope you're doing well!

{% assign CompletedCerts30DaysHighestTotal = CompletedCerts30DaysHighestTotal | default: 0 | times: 1 %}

{% if CompletedCerts30DaysHighestTotal > 0 %}
  In the last 30 days, {{ CompletedCerts30DaysHighestTotal | cast_highlight }} learner{% if CompletedCerts30DaysHighestTotalLabel != 1 -%}s{% endif %} passed the {{ CompletedCerts30DaysHighestTotalLabel | cast_pronounce | cast_highlight }}, which is {{ CompletedCerts30DaysHighestPercentage | cast_highlight }} of your total certified learners.
{% endif %}

Track your learners' progress, set goals, and identify areas for improvement.

{% if diffDays <= 60 %}
Get the most from your new ACME investment!
{% else %}
Continue to get the most out of your ACME investment!
{% endif %}


Using the EmailSubject and EmailBody snippets to personalize the Cast email sent to your contacts.

Check If String Exists in an Array

Use Case

Check if a Cast contact field is contained in a Cast array field to return a state

You can check if the value of a contact field exists in a Cast array field and return True or False.

The IsEMEA snippet checks if the contact field called country exists in the array field called EMEA_Countries.

{% comment %}
Snippet Name: IsEMEA
This snippet checks if the contact field called "country" and is found in the array field called EMEA_Countries.
{% endcomment %}

{% if EMEA_Countries contains country %}
  True
{% else %}
  False
{% endif %}

This snippet is used in Generate Conditions of a campaign to only generate casts if the contact is from an EMEA country.

The array field EMEA_Countries contains countries shown at the bottom of the screenshot.

The contact field “country” for Cheryl is the United States.

The IsEMEA snippet is used in Generate Conditions and Cheryl will not have a cast generated for her.

Benchmarking and Gamification using Liquid

Below is an example using Liquid to compare a field containing usage to a specific customer account to a field with a calculated average of all the customer accounts to do a benchmark comparison and create the narration for it. The field values are from the datasets provided by the customer.

{% assign u = accountUsage|times:1 %}
{% assign a=  avgUsage|times:1 %}
{% if u  > a %}
    {% assign percentage = u| divided_by:a|times:100|round:0 %}
    Your product usage within SaaS Magic is {{percentage}} above the industry average of companies similar to your size. Congratulations!
{% else %}
    Your product usage within SaaS Magic is below the industry average
    of companies similar to your size.

    Contact your {{"CSM" | cast_pronounce }} for ideas on
    how you can increase your usage in the platform.
{% endif %}

Output:

    Your product usage within SaaS Magic is below the industry average
    of companies similar to your size.

    Contact your CSM for ideas on
    how you can increase your usage in the platform.

Use Case #1

A customer wanted the narrative for their product usage to dynamically point out to the customer either a positve or negative outcome based on their current usage vs. their usage from the previous quarter. The snippet analysis_usage_determination was created to accomplish this. The Liquid code in the snippet compares the field that contains customers’ average from the previous quarter, analysis_prev_qtr_avg, to the field that contains the average in the current quarter, analysis_current_qtr_avg. The narration shown to the customer is based on whether their usage in the current quarter increased, decreased, or stayed the same. Liquid is used to calculate the percentage increase or decrease of usage to be shown in narration.

{% comment %}
Narration for Analyis scene. There are 3 branches: neutral, positive, and negative.
{% endcomment %}

{% assign analysis_current_qtr_avg = analysis_current_qtr_avg | times:1.0 %}
{% assign analysis_prev_qtr_avg = analysis_prev_qtr_avg | times:1.0 %}

{%- if analysis_current_qtr_avg > analysis_prev_qtr_avg -%}

Compared to the previous three month period, your monthly average increased by --up--{{analysis_current_qtr_avg|minus:analysis_prev_qtr_avg|divided_by:analysis_current_qtr_avg|times:100|ceil|abs}}%. This was awesome to see!

{%- elsif analysis_current_qtr_avg < analysis_prev_qtr_avg -%}

However, your average monthly usage decreased from the previous three month period by {{analysis_prev_qtr_avg|minus:analysis_current_qtr_avg|divided_by:analysis_prev_qtr_avg|times:100|ceil|abs}}%.

{%- elsif analysis_current_qtr_avg == analysis_prev_qtr_avg -%}

This usage level is consistent with the previous three month period as well!
{%- endif%}

The snippet is inserted in the narration box in a slide. The text the snippet generates is shown under the box. The example below is a customer whose usage increased compared to the previous quarter.

The example below is a customer whose usage decreased compared to the previous quarter. Notice in both examples that all you have to do is create the snippet and the narrative text shown to the customer will change based on their data.

Use Case #2

A customer wanted the product usage narration to point out to the customer the amount of storage they used and the percentage used relative to their total subscripton. The snippet LeastPercentageUsed0to10 calculates the percentage used.

{% comment %}
This snippet calculates the percentage used of the lowest usage accounts
{% endcomment %}

{%assign LicenseUsage0to10LeastUsed = LicenseUsage0to10Least|times:1%}
{%assign LicenseUsage0to10LeastReserve = LicenseUsage0to10LeastReserve|times:1%}

{%assign percentageUsed = LicenseUsage0to10LeastUsed|divided_by:LicenseUsage0to10LeastReserve|times:100%}

{{percentageUsed|round:2}}

You can insert Liquid code in the narration box as well as snippets to generate the text you want. Below is an example of using the snippet LeastPercentageUsed0to10 in the narration box as well as other Liquid code. if-endif block is used to check if the perentage that is calculated by the snippet is greater than 1, and if so use the round filter to display the percenatage with no decimals. The custom cast_footnote filter is used so that the contract name won’t be read by the bot, but it willl be displayed in the narration. The append filter is used to add the ‘%’ and ‘TiBs’ to the respective text.

The text that is generated from the snippet and Liquid is code shown under the box.

Here is the complete Liquid code used in the narration box.

{%assign LeastPercentageUsed0to10 = LeastPercentageUsed0to10|times:1%}

{% if LeastPercentageUsed0to10 >= 1%}
{%assign LeastPercentageUsed0to10 = LeastPercentageUsed0to10|round%}
{% endif %}

This site{{ LicenseUsage0to10LeastLabel | cast_footnote }} used only {{ LicenseUsage0to10Least | cast_highlight }} {{ "TiBs" | cast_pronounce|cast_highlight }} during this period, which is {{LeastPercentageUsed0to10|append:"%"| cast_highlight }} of the reserved capacity available.

Avatar Name Generators

Random Female Avatar

Generates consistent female names based on contact ID and day of week. Perfect for creating personalized demo data where you need the same user to see the same name within a day, but allow for variation across different days.

Snippet:

{% comment %}
Generates a female name based on contact_id and day of week
{% endcomment %}

{% assign names = "Amy,Bella,Chloe,Diana,Emily,Fiona,Grace,Hannah,Ivy,Julia,Kayla,Lily,Madison,Natalie,Olivia,Pamela,Quinn,Rachel,Sophia,Taylor,Uma,Vivian,Willow,Xena,Yasmin,Zoe" | split: ',' %}

{% assign dow = "now" | date: "%w" | minus: 1 | modulo: 7 %}
{% assign contactId = contact_id | default: 1 %}
{% assign nameIndex = contactId | times: dow | modulo: names.size %}
{% assign selectedName = names[nameIndex] %}

{{ selectedName }}

Random Male Avatar

Creates consistent male names using contact ID and day of week. Ensures the same user sees the same name throughout a day while enabling variety across different days. Ideal for demo environments requiring persistent male identities.

Snippet:

{% comment %}
Generates a male name based on contact_id and day of week
{% endcomment %}

{% assign names = "Adam,Brian,Charles,Daniel,Ethan,Frank,George,Henry,Isaac,Jack,Kevin,Liam,Michael,Nathan,Oliver,Peter,Quincy,Ryan,Samuel,Thomas,Uri,Victor,William,Xander,Yusuf,Zachary" | split: ',' %}

{% assign dow = "now" | date: "%w" | minus: 1 | modulo: 7 %}
{% assign contactId = contact_id | default: 1 %}
{% assign nameIndex = contactId | times: dow | modulo: names.size %}
{% assign selectedName = names[nameIndex] %}

{{ selectedName }}

Joke Generators

Generic Dad Jokes

Randomly selects family-friendly dad jokes based on timestamp. Includes emoji reactions and proper formatting for question-answer pairs. Great for adding humor to any interface.

Snippet:

{% comment %}
Generates a random dad joke based on current timestamp
Space after "?" required in jokes list
{% endcomment %}

{% assign dadJokes = "What did one ocean say to the other? Nothing, they just waved.👋**Did you hear about the guy who invented Lifesavers? He made a mint.**Why did the scarecrow win an award? Because he was outstanding in his field." | split: '**' %}

{% assign rightNow = 'now' | date: '%s' %}
{% assign randomJokeIndex = rightNow | modulo: dadJokes.size %}
{% assign randomJoke = dadJokes[randomJokeIndex] | split: '? ' %}

{{ randomJoke[0] | append: '?***' | append: randomJoke[1]}}

Thanksgiving Dad Jokes

Holiday-specific jokes themed around Thanksgiving. Uses contact ID for consistency and includes themed emojis. Can be split into question and answer components for flexible display options.

Snippet:

{% comment %}
Thanksgiving themed jokes based on contact_id
Usage:
{{thanksgivingDadJoke | split:"**__*" | first}} - for question
{{thanksgivingDadJoke | split:"**__*" | last}} - for answer
{% endcomment %}

{% assign dadJokes = "🦃 Why did the turkey bring a microphone to dinner? Because it wanted to give a drumstick performance.**🍂 Why don't turkeys play cards? They're afraid of getting roasted.**🥧 What's a turkey's favorite dessert? Peach gobbler!" | split: '**' %}

{% assign rightNow = contact_id | default: 1 %}
{% assign randomJokeIndex = rightNow | modulo: dadJokes.size %}
{% assign randomJoke = dadJokes[randomJokeIndex] | split: '? ' %}

{{ randomJoke[0] | append: '?**__*' | append: randomJoke[1]}}

Date Difference Calculator

A comprehensive Liquid template for calculating the exact difference between two dates, breaking it down into years, months, days, hours, minutes, and seconds.


{%- comment -%}
# Calculates the time difference between two dates and formats it as a human-readable duration
# Input format: Dates should be in ISO 8601 format (YYYY-MM-DD HH:MM:SS) or Unix timestamp
#
# Examples:
# 1. Same day, different hours:
#    start_date: "2024-01-01 09:00:00"
#    end_date:   "2024-01-01 17:30:00"
#    Output: "8h 30m"
#
# 2. Different days in same month:
#    start_date: "2024-01-01 00:00:00"
#    end_date:   "2024-01-15 12:00:00"
#    Output: "14d 12h"
#
# 3. Different months:
#    start_date: "2024-01-01 00:00:00"
#    end_date:   "2024-03-15 10:30:00"
#    Output: "2m 14d 10h 30m"
#
# 4. Different years:
#    start_date: "2023-01-01 00:00:00"
#    end_date:   "2024-03-15 10:30:00"
#    Output: "1y 2m 14d 10h 30m"
#
# 5. Unix timestamp format:
#    start_date: 1704067200  (2024-01-01 00:00:00)
#    end_date:   1704153600  (2024-01-02 00:00:00)
#    Output: "1d"
{%- endcomment -%}

{%- assign normalized_start_date = start_date | date: '%s' -%}
{%- assign normalized_end_date = end_date | date: '%s' -%}

{%- assign start_date = normalized_start_date | plus: 0 -%}
{%- assign end_date = normalized_end_date | plus: 0 -%}
{%- assign diff_seconds = end_date | minus: start_date -%}

{%- assign years = diff_seconds | divided_by: 31536000 -%}
{%- assign remaining_after_years = diff_seconds | modulo: 31536000 -%}

{%- assign months = remaining_after_years | divided_by: 2592000 -%}
{%- assign remaining_after_months = remaining_after_years | modulo: 2592000 -%}

{%- assign days = remaining_after_months | divided_by: 86400 -%}
{%- assign remaining_after_days = remaining_after_months | modulo: 86400 -%}

{%- assign hours = remaining_after_days | divided_by: 3600 -%}
{%- assign remaining_after_hours = remaining_after_days | modulo: 3600 -%}

{%- assign minutes = remaining_after_hours | divided_by: 60 -%}
{%- assign seconds = remaining_after_hours | modulo: 60 -%}

{%- capture output -%}
{%- if years > 0 -%}{{ years }}y{%- endif -%}
{%- if months > 0 -%}{{ months }}m{%- endif -%}
{%- if days > 0 -%}{{ days }}d{%- endif -%}
{%- if hours > 0 -%}{{ hours }}h{%- endif -%}
{%- if minutes > 0 -%}{{ minutes }}m{%- endif -%}
{%- if seconds > 0 -%}{{ seconds }}s{%- endif -%}
{%- endcapture -%}

{{ output | strip }}

### Short Time Period
```liquid
{% assign start_date = '2024-12-12 09:00:00' %}
{% assign end_date = '2024-12-12 17:30:00' %}

{%- assign normalized_start_date = start_date | date: '%s' -%}
[... same calculation code as above ...]
{{ output | strip }}

Output: 8h30m

Here are some real-life use cases where this time difference calculator would be valuable:

Project Management/Task Tracking:

start_date: "2024-01-15 09:00:00"  # Project start
end_date: "2024-03-20 17:00:00"    # Current date
Output: "2m 5d 8h"                 # Shows project duration so far

# Usage: Display how long a task has been in progress
# Example: "Task in progress for 2m 5d 8h"

Service Uptime Monitoring:

start_date: "2024-01-01 00:00:00"  # Last server downtime
end_date: "2024-03-19 14:30:00"    # Current time
Output: "2m 18d 14h 30m"           # Shows continuous uptime

# Usage: Display server/service uptime
# Example: "Server uptime: 2m 18d 14h 30m"

User Account Age:

start_date: "2023-06-15 00:00:00"  # User registration date
end_date: "2024-03-19 00:00:00"    # Current date
Output: "9m 4d"                    # Shows how long user has been member

# Usage: Display member since duration
# Example: "Member for: 9m 4d"

Support Ticket Response Time:

start_date: "2024-03-18 10:00:00"  # Ticket creation time
end_date: "2024-03-19 11:30:00"    # Response time
Output: "1d 1h 30m"                # Shows response time

# Usage: Track support team response times
# Example: "Response time: 1d 1h 30m"

Content Age Display:

start_date: "2023-12-25 15:30:00"  # Article publication date
end_date: "2024-03-19 10:00:00"    # Current time
Output: "2m 24d 18h 30m"           # Shows how old the content is

# Usage: Display how long ago content was published
# Example: "Published: 2m 24d 18h 30m ago"

SLA (Service Level Agreement) Tracking:

start_date: "2024-03-19 09:00:00"  # Issue reported
end_date: "2024-03-19 13:45:00"    # Resolution time
Output: "4h 45m"                   # Time taken to resolve

# Usage: Monitor if resolution was within SLA
# Example: "Resolution time: 4h 45m"

Subscription Duration:

start_date: "2023-01-01 00:00:00"  # Subscription start
end_date: "2024-03-19 00:00:00"    # Current date
Output: "1y 2m 18d"                # Duration of subscription

# Usage: Show how long user has been subscribed
# Example: "Subscribed for: 1y 2m 18d"