From 78856ca62b27c683660f1b9bf8de28224f23b853 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 6 Mar 2025 11:17:28 +0100 Subject: [PATCH] Add helper description --- packages/string-templates/scripts/gen-collection-info.ts | 7 +++++++ packages/string-templates/src/manifest.json | 9 +++++++++ 2 files changed, 16 insertions(+) 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