Skip to main content

currentTime

@forge/monorepo


@forge/monorepo / backend/src / currentTime

Function: currentTime()

currentTime(input?): TimeResult

Defined in: backend/src/toolkit/compute.ts:152

The current time, in a named zone.

A model has no clock -- it has a training cutoff, and it will answer "what is today's date" with something plausible and wrong. The zone is a parameter because "today" is a different day depending on where the person asking is, and the caller is often not in UTC.

The clock is injected so a test can pin it, which is the convention everywhere else in this runtime.

Parameters

input?

now?

() => Date

timeZone?

string

Returns

TimeResult