diff --git a/packages/string-templates/scripts/gen-collection-info.ts b/packages/string-templates/scripts/gen-collection-info.ts index d231908a05..406c2959a5 100644 --- a/packages/string-templates/scripts/gen-collection-info.ts +++ b/packages/string-templates/scripts/gen-collection-info.ts @@ -44,6 +44,13 @@ const ADDED_HELPERS = { description: "Produce a humanized duration left/until given an amount of time and the type of time measurement.", }, + difference: { + args: ["from", "to", "[unitType=ms]"], + example: + '{{ difference "2025-09-30" "2025-06-17" "seconds" }} -> 9072000', + description: + "Gets the difference between two dates, in milliseconds. Pass a third parameter to adjust the unit measurement.", + }, }, } diff --git a/packages/string-templates/src/manifest.json b/packages/string-templates/src/manifest.json index e399dbff94..7b6ac7aca0 100644 --- a/packages/string-templates/src/manifest.json +++ b/packages/string-templates/src/manifest.json @@ -1222,6 +1222,15 @@ ], "example": "{{duration 8 \"seconds\"}} -> a few seconds", "description": "
Produce a humanized duration left/until given an amount of time and the type of time measurement.
\n" + }, + "difference": { + "args": [ + "from", + "to", + "[unitType=ms]" + ], + "example": "{{ difference \"2025-09-30\" \"2025-06-17\" \"seconds\" }} -> 9072000", + "description": "Gets the difference between two dates, in milliseconds. Pass a third parameter to adjust the unit measurement.
\n" } } } \ No newline at end of file