Date Diff
Input
| value |
|---|
Difference in days between value and 2024-01-01
transformation:dateDiff
Compute difference between two dates as a number
source:value
parameters
- unit
- compareMode
- compareTo
- compareToField
- inputFormat
Unit for the difference count
Literal date or another row field
Literal date string (when compare mode is Literal)
Row field name (when compare mode is Field)
Luxon format pattern for date strings (for example yyyy-MM-dd or MM/dd/yyyy).
Output
| value |
|---|
| 152 |
| 365 |
| 74 |
| 14 |
| 0 |
| invalid |
Sample inputs run locally in your browser using the same operation logic as Fontana Flow.
Results are illustrative, not connected to a workflow.
Compute difference between two dates as a number.
Parameters
- unit (Unit, string, required) — Unit for the difference count. Allowed values:
years,months,weeks,days,hours,minutes,seconds. - compareMode (Compare to, string, optional) — Literal date or another row field. Allowed values:
literal,field. - compareTo (Compare to date, string, optional) — Literal date string (when compare mode is Literal). Examples:
"2026-01-01","2025-12-31". - compareToField (Compare to field, string, optional) — Row field name (when compare mode is Field). Default:
"". - inputFormat (Input format, string, optional) — Luxon format pattern for date strings (for example yyyy-MM-dd or MM/dd/yyyy). Examples:
"yyyy-MM-dd","MM/dd/yyyy","dd-MM-yyyy".
Field selection
- source — Field whose values this operation reads. Omit to apply to all fields on the row.
- target — Optional output field. When omitted, the source field is updated in place.
JSON Configuration
{ "id": "op-dateDiff", "type": "transformation", "action": "dateDiff", "params": { "compareMode": "literal", "compareTo": "2024-01-01", "compareToField": "", "inputFormat": "yyyy-MM-dd", "unit": "days" }, "testInputs": [ "2024-06-01", "2024-12-31", "2024-03-15", "2024-01-15", "2024-01-01", "invalid" ]}