Date Connector
The Date Connector provides a comprehensive set of date and time operations for formatting, parsing, arithmetic, and comparison. ***
Date Connector
The Date Connector provides a comprehensive set of date and time operations for formatting, parsing, arithmetic, and comparison.
Available Units
Many operations accept a unit parameter. The following units are supported (from Moment.js):
| Unit | Shorthand | Description |
|---|---|---|
years | y | Year |
quarters | Q | Quarter (3-month period) |
months | M | Month |
weeks | w | Week |
days | d | Day |
hours | h | Hour |
minutes | m | Minute |
seconds | s | Second |
milliseconds | ms | Millisecond |
Note: Both singular (
year,day) and plural (years,days) forms are accepted.
Unit Usage by Operation
| Operation | Supported Units | Default |
|---|---|---|
add | All units | days |
subtract | All units | days |
diff | All units | days |
startOf | year, quarter, month, week, day, hour, minute, second | day |
endOf | year, quarter, month, week, day, hour, minute, second | day |
range | All units | days |
isBefore | All units (optional granularity) | - |
isAfter | All units (optional granularity) | - |
isBetween | All units (optional granularity) | - |
Operations
now
nowReturns the current date and time.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
format | string | No | ISO8601 | Output format (e.g., YYYY-MM-DD, MM/DD/YYYY) |
Examples
// Input
{ "operation": "now", "data": {} }
// Output
{ "result": "2024-01-15T10:30:00.000Z" }// Input with format
{ "operation": "now", "data": { "format": "YYYY-MM-DD" } }
// Output
{ "result": "2024-01-15" }format
formatFormats a date into a specified string format.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
date | string | Yes | - | The date to format |
format | string | No | YYYY-MM-DD | The output format |
Examples
// Input
{ "operation": "format", "data": { "date": "2024-01-15T10:30:00Z", "format": "MMMM Do, YYYY" } }
// Output
{ "result": "January 15th, 2024" }parse
parseParses a date string from one format to another.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
date | string | Yes | - | The date string to parse |
inputFormat | string | No | Auto-detect | The format of the input date |
outputFormat | string | No | YYYY-MM-DD | The desired output format |
Examples
// Input
{ "operation": "parse", "data": { "date": "15/01/2024", "inputFormat": "DD/MM/YYYY", "outputFormat": "YYYY-MM-DD" } }
// Output
{ "result": "2024-01-15" }add
addAdds a specified amount of time to a date.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
date | string | Yes | - | The starting date |
amount | number | No | 0 | The amount to add |
unit | string | No | days | The unit (see Available Units) |
format | string | No | ISO8601 | Output format |
Examples
// Add 7 days
{ "operation": "add", "data": { "date": "2024-01-15", "amount": 7, "unit": "days", "format": "YYYY-MM-DD" } }
// Output
{ "result": "2024-01-22" }// Add 2 weeks
{ "operation": "add", "data": { "date": "2024-01-15", "amount": 2, "unit": "weeks", "format": "YYYY-MM-DD" } }
// Output
{ "result": "2024-01-29" }// Add 3 months
{ "operation": "add", "data": { "date": "2024-01-15", "amount": 3, "unit": "months", "format": "YYYY-MM-DD" } }
// Output
{ "result": "2024-04-15" }subtract
subtractSubtracts a specified amount of time from a date.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
date | string | Yes | - | The starting date |
amount | number | No | 0 | The amount to subtract |
unit | string | No | days | The unit (see Available Units) |
format | string | No | ISO8601 | Output format |
Examples
// Subtract 1 month
{ "operation": "subtract", "data": { "date": "2024-01-15", "amount": 1, "unit": "months", "format": "YYYY-MM-DD" } }
// Output
{ "result": "2023-12-15" }// Subtract 1 year
{ "operation": "subtract", "data": { "date": "2024-01-15", "amount": 1, "unit": "years", "format": "YYYY-MM-DD" } }
// Output
{ "result": "2023-01-15" }// Subtract 6 hours
{ "operation": "subtract", "data": { "date": "2024-01-15T12:00:00Z", "amount": 6, "unit": "hours" } }
// Output
{ "result": "2024-01-15T06:00:00.000Z" }diff
diffCalculates the difference between two dates.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
startDate | string | Yes | - | The start date |
endDate | string | Yes | - | The end date |
unit | string | No | days | The unit (see Available Units) |
precise | boolean | No | false | Whether to return a floating-point value |
Examples
// Difference in days
{ "operation": "diff", "data": { "startDate": "2024-01-01", "endDate": "2024-01-15", "unit": "days" } }
// Output
{ "result": 14 }// Difference in months
{ "operation": "diff", "data": { "startDate": "2024-01-01", "endDate": "2024-06-01", "unit": "months" } }
// Output
{ "result": 5 }// Precise difference in days
{ "operation": "diff", "data": { "startDate": "2024-01-01", "endDate": "2024-01-15T12:00:00Z", "unit": "days", "precise": true } }
// Output
{ "result": 14.5 }// Difference in hours
{ "operation": "diff", "data": { "startDate": "2024-01-15T08:00:00Z", "endDate": "2024-01-15T17:30:00Z", "unit": "hours", "precise": true } }
// Output
{ "result": 9.5 }isBefore
isBeforeChecks if a date is before another date.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
date | string | Yes | - | The date to check |
compareDate | string | Yes | - | The date to compare against |
unit | string | No | - | Granularity (see Available Units) |
Examples
// Basic comparison
{ "operation": "isBefore", "data": { "date": "2024-01-01", "compareDate": "2024-01-15" } }
// Output
{ "result": true }// Compare at month granularity (same month = false)
{ "operation": "isBefore", "data": { "date": "2024-01-15", "compareDate": "2024-01-01", "unit": "month" } }
// Output
{ "result": false }isAfter
isAfterChecks if a date is after another date.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
date | string | Yes | - | The date to check |
compareDate | string | Yes | - | The date to compare against |
unit | string | No | - | Granularity (see Available Units) |
Examples
// Basic comparison
{ "operation": "isAfter", "data": { "date": "2024-01-15", "compareDate": "2024-01-01" } }
// Output
{ "result": true }// Compare at year granularity
{ "operation": "isAfter", "data": { "date": "2024-06-15", "compareDate": "2023-12-31", "unit": "year" } }
// Output
{ "result": true }isBetween
isBetweenChecks if a date falls between two other dates.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
date | string | Yes | - | The date to check |
startDate | string | Yes | - | The range start date |
endDate | string | Yes | - | The range end date |
unit | string | No | - | Granularity (see Available Units) |
inclusivity | string | No | [] | Inclusivity mode (see below) |
Inclusivity Options:
| Value | Description |
|---|---|
() | Excludes both start and end |
[] | Includes both start and end (default) |
[) | Includes start, excludes end |
(] | Excludes start, includes end |
Examples
// Inclusive check (default)
{ "operation": "isBetween", "data": { "date": "2024-01-10", "startDate": "2024-01-01", "endDate": "2024-01-31" } }
// Output
{ "result": true }// Exclusive check
{ "operation": "isBetween", "data": { "date": "2024-01-01", "startDate": "2024-01-01", "endDate": "2024-01-31", "inclusivity": "()" } }
// Output
{ "result": false }startOf
startOfGets the start of a time unit for a given date.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
date | string | Yes | - | The date |
unit | string | No | day | The unit (see Available Units) |
format | string | No | ISO8601 | Output format |
Examples
// Start of month
{ "operation": "startOf", "data": { "date": "2024-01-15T14:30:00Z", "unit": "month", "format": "YYYY-MM-DD" } }
// Output
{ "result": "2024-01-01" }// Start of year
{ "operation": "startOf", "data": { "date": "2024-06-15", "unit": "year", "format": "YYYY-MM-DD" } }
// Output
{ "result": "2024-01-01" }// Start of week
{ "operation": "startOf", "data": { "date": "2024-01-15", "unit": "week", "format": "YYYY-MM-DD" } }
// Output
{ "result": "2024-01-14" }// Start of day
{ "operation": "startOf", "data": { "date": "2024-01-15T14:30:00Z", "unit": "day", "format": "YYYY-MM-DD HH:mm:ss" } }
// Output
{ "result": "2024-01-15 00:00:00" }endOf
endOfGets the end of a time unit for a given date.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
date | string | Yes | - | The date |
unit | string | No | day | The unit (see Available Units) |
format | string | No | ISO8601 | Output format |
Examples
// End of month
{ "operation": "endOf", "data": { "date": "2024-01-15", "unit": "month", "format": "YYYY-MM-DD HH:mm:ss" } }
// Output
{ "result": "2024-01-31 23:59:59" }// End of year
{ "operation": "endOf", "data": { "date": "2024-06-15", "unit": "year", "format": "YYYY-MM-DD" } }
// Output
{ "result": "2024-12-31" }// End of quarter
{ "operation": "endOf", "data": { "date": "2024-02-15", "unit": "quarter", "format": "YYYY-MM-DD" } }
// Output
{ "result": "2024-03-31" }fromNow
fromNowReturns a human-readable relative time string from now.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
date | string | Yes | - | The date to compare |
withoutSuffix | boolean | No | false | Remove the "ago"/"in" suffix |
Examples
// Past date (assuming current date is 2024-01-15)
{ "operation": "fromNow", "data": { "date": "2024-01-10" } }
// Output
{ "result": "5 days ago" }// Future date
{ "operation": "fromNow", "data": { "date": "2024-01-20" } }
// Output
{ "result": "in 5 days" }// Without suffix
{ "operation": "fromNow", "data": { "date": "2024-01-20", "withoutSuffix": true } }
// Output
{ "result": "5 days" }range
rangeGenerates an array of dates between a start and end date.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
startDate | string | Yes | - | The range start date |
endDate | string | Yes | - | The range end date |
unit | string | No | days | The unit (see Available Units) |
step | number | No | 1 | The step increment |
format | string | No | ISO8601 | Output format for each date |
Examples
// Daily range
{ "operation": "range", "data": { "startDate": "2024-01-01", "endDate": "2024-01-05", "unit": "days", "format": "YYYY-MM-DD" } }
// Output
{ "result": ["2024-01-01", "2024-01-02", "2024-01-03", "2024-01-04", "2024-01-05"] }// Weekly range
{ "operation": "range", "data": { "startDate": "2024-01-01", "endDate": "2024-01-31", "unit": "weeks", "format": "YYYY-MM-DD" } }
// Output
{ "result": ["2024-01-01", "2024-01-08", "2024-01-15", "2024-01-22", "2024-01-29"] }// Monthly range
{ "operation": "range", "data": { "startDate": "2024-01-01", "endDate": "2024-06-01", "unit": "months", "format": "MMMM YYYY" } }
// Output
{ "result": ["January 2024", "February 2024", "March 2024", "April 2024", "May 2024", "June 2024"] }// Every 2 days
{ "operation": "range", "data": { "startDate": "2024-01-01", "endDate": "2024-01-10", "unit": "days", "step": 2, "format": "YYYY-MM-DD" } }
// Output
{ "result": ["2024-01-01", "2024-01-03", "2024-01-05", "2024-01-07", "2024-01-09"] }filterBetween
filterBetweenFilters a collection of objects to include only items where the date at the specified path falls between the start and end dates.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
collection | array | Yes | - | The array of objects to filter |
datePath | string | Yes | - | Path to the date property (dot notation supported) |
startDate | string | Yes | - | The range start date |
endDate | string | Yes | - | The range end date |
inclusivity | string | No | [] | Inclusivity mode (see below) |
Inclusivity Options:
| Value | Description |
|---|---|
() | Excludes both start and end |
[] | Includes both start and end (default) |
[) | Includes start, excludes end |
(] | Excludes start, includes end |
Examples
// Filter appointments within a time range (inclusive)
{
"operation": "filterBetween",
"data": {
"collection": [
{ "durationMinutes": 15, "appointmentDateTimeLocal": "2026-01-24T09:00-08:00" },
{ "durationMinutes": 15, "appointmentDateTimeLocal": "2026-01-24T09:15-08:00" },
{ "durationMinutes": 15, "appointmentDateTimeLocal": "2026-01-24T09:30-08:00" },
{ "durationMinutes": 15, "appointmentDateTimeLocal": "2026-01-24T09:45-08:00" },
{ "durationMinutes": 15, "appointmentDateTimeLocal": "2026-01-24T10:00-08:00" }
],
"datePath": "appointmentDateTimeLocal",
"startDate": "2026-01-24T09:15-08:00",
"endDate": "2026-01-24T09:45-08:00"
}
}
// Output
{
"result": [
{ "durationMinutes": 15, "appointmentDateTimeLocal": "2026-01-24T09:15-08:00" },
{ "durationMinutes": 15, "appointmentDateTimeLocal": "2026-01-24T09:30-08:00" },
{ "durationMinutes": 15, "appointmentDateTimeLocal": "2026-01-24T09:45-08:00" }
]
}// Filter with exclusive bounds
{
"operation": "filterBetween",
"data": {
"collection": [
{ "durationMinutes": 15, "appointmentDateTimeLocal": "2026-01-24T09:00-08:00" },
{ "durationMinutes": 15, "appointmentDateTimeLocal": "2026-01-24T09:15-08:00" },
{ "durationMinutes": 15, "appointmentDateTimeLocal": "2026-01-24T09:30-08:00" }
],
"datePath": "appointmentDateTimeLocal",
"startDate": "2026-01-24T09:00-08:00",
"endDate": "2026-01-24T09:30-08:00",
"inclusivity": "()"
}
}
// Output
{
"result": [
{ "durationMinutes": 15, "appointmentDateTimeLocal": "2026-01-24T09:15-08:00" }
]
}// Filter with nested date path
{
"operation": "filterBetween",
"data": {
"collection": [
{ "id": 1, "schedule": { "startTime": "2026-01-24T09:00-08:00" } },
{ "id": 2, "schedule": { "startTime": "2026-01-24T09:30-08:00" } },
{ "id": 3, "schedule": { "startTime": "2026-01-24T10:00-08:00" } }
],
"datePath": "schedule.startTime",
"startDate": "2026-01-24T09:00-08:00",
"endDate": "2026-01-24T09:30-08:00"
}
}
// Output
{
"result": [
{ "id": 1, "schedule": { "startTime": "2026-01-24T09:00-08:00" } },
{ "id": 2, "schedule": { "startTime": "2026-01-24T09:30-08:00" } }
]
}// Filter with inclusive start, exclusive end [)
{
"operation": "filterBetween",
"data": {
"collection": [
{ "id": 1, "date": "2026-01-24T09:00-08:00" },
{ "id": 2, "date": "2026-01-24T09:15-08:00" },
{ "id": 3, "date": "2026-01-24T09:30-08:00" }
],
"datePath": "date",
"startDate": "2026-01-24T09:00-08:00",
"endDate": "2026-01-24T09:30-08:00",
"inclusivity": "[)"
}
}
// Output
{
"result": [
{ "id": 1, "date": "2026-01-24T09:00-08:00" },
{ "id": 2, "date": "2026-01-24T09:15-08:00" }
]
}Using with Context Variables
When using context variables with LiquidJS templates, arrays and objects require special handling.
Important: Do not wrap array/object variables in quotes. Use the| jsonfilter to properly serialize them.
❌ Incorrect - Produces [object Object] strings:
{
"operation": "filterBetween",
"data": {
"collection": "{{context.data.availableAppointments}}",
"datePath": "appointmentDateTimeLocal",
"startDate": "{{context.selectedDate}}T{{context.startTime}}",
"endDate": "{{context.selectedDate}}T{{context.endTime}}",
"inclusivity": "[]"
}
}When rendered, this produces invalid output because LiquidJS converts the array to a string:
{
"collection": "[object Object][object Object][object Object]...",
"datePath": "appointmentDateTimeLocal",
"startDate": "2026-01-28T08:00:00",
"endDate": "2026-01-28T11:00:00",
"inclusivity": "[]"
}✅ Correct - Use | json filter without quotes:
{
"operation": "filterBetween",
"data": {
"collection": {{ context.data.availableAppointments | json }},
"datePath": "appointmentDateTimeLocal",
"startDate": "{{ context.selectedDate }}T{{ context.startTime }}",
"endDate": "{{ context.selectedDate }}T{{ context.endTime }}",
"inclusivity": "[]"
}
}Why this works:
- The
| jsonfilter serializes the array/object to a valid JSON string - Omitting the surrounding quotes allows the JSON array to be inserted directly as a value
- String variables (like dates) should still use quotes:
"{{ context.selectedDate }}"
General rule for LiquidJS templates in connector configs:
| Variable Type | Syntax | Example |
|---|---|---|
| String | "{{ variable }}" | "startDate": "{{ context.selectedDate }}" |
| Array/Object | {{ variable | json }} | "collection": {{ context.items | json }} |
| Number | {{ variable }} | "amount": {{ context.count }} |
| Boolean | {{ variable }} | "precise": {{ context.usePrecise }} |
Notes
- Items with missing date properties are excluded from the result
- Items with invalid/unparseable dates are excluded from the result
- The
datePathparameter supports dot notation for nested properties (e.g.,schedule.startTime) - Throws an error if
collectionis not an array
isValid
isValidChecks if a date string is valid.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
date | string | Yes | - | The date string to validate |
format | string | No | Auto-detect | Expected format for strict parsing |
Examples
// Valid ISO date
{ "operation": "isValid", "data": { "date": "2024-01-15" } }
// Output
{ "result": true }// Invalid date
{ "operation": "isValid", "data": { "date": "not-a-date" } }
// Output
{ "result": false }// Strict format validation
{ "operation": "isValid", "data": { "date": "15/01/2024", "format": "DD/MM/YYYY" } }
// Output
{ "result": true }// Wrong format (strict mode fails)
{ "operation": "isValid", "data": { "date": "2024-01-15", "format": "DD/MM/YYYY" } }
// Output
{ "result": false }Common Format Tokens
| Token | Description | Example |
|---|---|---|
YYYY | 4-digit year | 2024 |
YY | 2-digit year | 24 |
Q | Quarter | 1-4 |
MM | Month (zero-padded) | 01-12 |
M | Month | 1-12 |
MMM | Month abbreviation | Jan, Feb |
MMMM | Full month name | January |
DD | Day (zero-padded) | 01-31 |
D | Day | 1-31 |
Do | Day with ordinal | 1st, 2nd, 15th |
dddd | Day of week | Monday |
ddd | Day abbreviation | Mon |
HH | Hour 24h (padded) | 00-23 |
H | Hour 24h | 0-23 |
hh | Hour 12h (padded) | 01-12 |
h | Hour 12h | 1-12 |
mm | Minutes (padded) | 00-59 |
m | Minutes | 0-59 |
ss | Seconds (padded) | 00-59 |
s | Seconds | 0-59 |
A | AM/PM | AM, PM |
a | am/pm | am, pm |
X | Unix timestamp (sec) | 1705312200 |
x | Unix timestamp (ms) | 1705312200000 |
Updated 6 days ago