Skip to main content

bucketStartFor

@forge/monorepo


@forge/monorepo / backend/src / bucketStartFor

Function: bucketStartFor()

bucketStartFor(period, at): string

Defined in: backend/src/usage/quota.ts:56

The instant a period's bucket opens, for a given moment.

Truncation in UTC, deliberately. A tenant-local day would make a bucket's identity depend on a timezone setting that can change, and a rollup already written under the old offset would silently belong to a different day than one written after — so "yesterday" would double-count an hour or lose one. Presenting totals in local time is a display concern; storing them in one is a correctness bug.

Parameters

period

"hour" | "day" | "week" | "month"

at

string

Returns

string