Skip to content

Commit 939c48b

Browse files
committed
enhance: add sys.date.now built in for time/date.
Signed-off-by: Bill Maxwell <[email protected]>
1 parent 025e638 commit 939c48b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pkg/builtin/builtin.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ var tools = map[string]types.Tool{
5151
},
5252
BuiltinFunc: SysWorkspaceRead,
5353
},
54+
"sys.date.now": {
55+
Parameters: types.Parameters{
56+
Description: "Returns the current date and time in RFC3339 format",
57+
},
58+
BuiltinFunc: SysDateNow,
59+
},
5460
"sys.ls": {
5561
Parameters: types.Parameters{
5662
Description: "Lists the contents of a directory",
@@ -812,3 +818,7 @@ func SysPrompt(_ context.Context, _ []string, input string) (_ string, err error
812818

813819
return string(resultsStr), nil
814820
}
821+
822+
func SysDateNow(ctx context.Context, env []string, input string) (string, error) {
823+
return time.Now().Format(time.RFC3339), nil
824+
}

0 commit comments

Comments
 (0)