Skip to content

Commit db9a857

Browse files
authored
Merge pull request #603 from odilitime/time-fix
fix: time prompt to include UTC, convert to verbose english to help prompting
2 parents 529f977 + d59c65e commit db9a857

File tree

1 file changed

+11
-4
lines changed
  • packages/plugin-bootstrap/src/providers

1 file changed

+11
-4
lines changed

packages/plugin-bootstrap/src/providers/time.ts

+11-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,17 @@ import { IAgentRuntime, Memory, Provider, State } from "@ai16z/eliza";
33
const timeProvider: Provider = {
44
get: async (_runtime: IAgentRuntime, _message: Memory, _state?: State) => {
55
const currentDate = new Date();
6-
const currentTime = currentDate.toLocaleTimeString("en-US");
7-
const currentYear = currentDate.getFullYear();
8-
return `The current time is: ${currentTime}, ${currentYear}`;
6+
7+
// Get UTC time since bots will be communicating with users around the global
8+
const options = {
9+
timeZone: "UTC",
10+
dateStyle: "full" as "full",
11+
timeStyle: "long" as "long",
12+
};
13+
const humanReadable = new Intl.DateTimeFormat("en-US", options).format(
14+
currentDate
15+
);
16+
return `The current date and time is ${humanReadable}. Please use this as your reference for any time-based operations or responses.`;
917
},
1018
};
11-
1219
export { timeProvider };

0 commit comments

Comments
 (0)