Skip to content

Commit

Permalink
feat: added functions nowsub and nowadd
Browse files Browse the repository at this point in the history
  • Loading branch information
ugol committed Sep 27, 2024
1 parent 951b2aa commit 15cfd2d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/functions/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ var fmap = map[string]interface{}{
"future": Future,
"past": Past,
"recent": Recent,
"justpassed": Justpassed,
"just_passed": Justpassed,
"now_sub": Nowsub,
"now_add": Nowadd,
"soon": Soon,
Expand Down
26 changes: 23 additions & 3 deletions pkg/functions/functionsDescription.go
Original file line number Diff line number Diff line change
Expand Up @@ -654,14 +654,14 @@ var funcDesc = map[string]FunctionDescription{
Example: "jr template run --embedded '{{join \"hello,\" \"world\"}}'",
Output: "hello,world",
},
"justpassed": {
Name: "justpassed",
"just_passed": {
Name: "just_passed",
Category: "time",
Description: "returns a date in the past not before the given milliseconds",
Parameters: "milliseconds int",
Localizable: false,
Return: "string",
Example: "jr template run --embedded '{{justpassed 60000}}'",
Example: "jr template run --embedded '{{just_passed 60000}}'",
Output: "2024-11-10 22:59:5",
},
"key": {
Expand Down Expand Up @@ -884,6 +884,26 @@ var funcDesc = map[string]FunctionDescription{
Example: "jr template run --embedded '{{nearby_gps 41.9028 12.4964 1000}}'",
Output: "41.8963 12.4975",
},
"now_add": {
Name: "now_add",
Category: "time",
Description: "returns a date in the future for the given milliseconds",
Parameters: "milliseconds int",
Localizable: false,
Return: "string",
Example: "jr template run --embedded '{{now_add 60000}}'",
Output: "2024-11-10 21:50:00",
},
"now_sub": {
Name: "now_sub",
Category: "time",
Description: "returns a date in the past for the given milliseconds",
Parameters: "milliseconds int",
Localizable: false,
Return: "string",
Example: "jr template run --embedded '{{now_sub 60000}}'",
Output: "2024-11-10 22:01:00",
},
"password": {
Name: "password",
Category: "security",
Expand Down

0 comments on commit 15cfd2d

Please sign in to comment.