Skip to content

Commit 75fcc43

Browse files
pwnqgljxsclaude
andcommitted
Document ctx.date.nowMillis() in both plugin API references
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 6504584 commit 75fcc43

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

docs/plugin-prototype.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ built-ins, but no browser or Node host environment. Tests assert that `fetch`, `
120120
positive and capped at 24 hours.
121121
- `ctx.date.now()`, `iso(text)`, `unixSeconds(number)`, and `unixMillis(number)` return JavaScript `Date` objects.
122122
`now()` uses the host refresh clock so fixtures and retries share the snapshot timestamp.
123+
- `ctx.date.nowMillis()` returns that same refresh clock as Unix epoch milliseconds for deterministic date arithmetic
124+
(used by the z.ai quota-rate row).
123125
- `ctx.date.nextDailyReset(timeZoneIdentifier, hour)` returns the next wall-clock hour in an IANA time zone, including
124126
DST transitions. Crof uses `America/Chicago` at hour `0`.
125127
- `ctx.jwt.decode(token)` decodes the JSON payload segment without verifying a signature.

docs/plugins.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ so portable third-party plugins must use the host helpers below instead of ECMA-
106106
24 hours.
107107
- `ctx.date.now()`, `iso(text)`, `unixSeconds(number)`, and `unixMillis(number)` create JavaScript dates. `now()` uses
108108
the host refresh clock.
109+
- `ctx.date.nowMillis()` returns the same host refresh clock as Unix epoch milliseconds — use it for arithmetic that
110+
should stay deterministic under fixture clocks (the z.ai quota-rate row does).
109111
- `ctx.date.nextDailyReset(timeZoneIdentifier, hour)` returns the next wall-clock reset in an IANA time zone.
110112
- `ctx.env.timeZone` is the host's current IANA time-zone identifier; zero-offset GMT aliases are normalized to `UTC`.
111113
- `ctx.format.number(value, options?)`, `usd(value)`, and `monthDay(date)` provide deterministic formatting on both

0 commit comments

Comments
 (0)