Prism · Time

$dateDiff

Measures from one date to another, in a unit.

The source
{
  createdAt: '2024-01-15T08:30:00Z',
  now: '2024-04-22T10:00:00Z',
}
The config
{
  $dateDiff: {
    from: { $ref: '$.createdAt' },
    to: { $ref: '$.now' },
    unit: 'day',
  },
}
What comes out
98
Output matches the expected value

Runs in this page on the installed package. The input and the expected output are defined by the example.