API reference › @evolu/common › local‑first/Timestamp › isTimestampBeyondMaxDrift
function isTimestampBeyondMaxDrift(
deps: TimestampConfigDep,
): (
millis: number &
Brand<"NonNaN"> &
Brand<"Finite"> &
Brand<"Int"> &
Brand<"NonNegative"> &
Brand<"LessThan281474976710655"> &
Brand<"Millis">,
now: number &
Brand<"NonNaN"> &
Brand<"Finite"> &
Brand<"Int"> &
Brand<"NonNegative"> &
Brand<"LessThan281474976710655"> &
Brand<"Millis">,
) => boolean;
Defined in: packages/common/src/local-first/Timestamp.ts:618
Whether timestamp milliseconds exceed TimestampConfig.maxDrift ahead of the supplied reference time. The exact limit and past timestamps are accepted.
Example
import { assertFalse, assertTrue, Millis } from "@evolu/common";
import { isTimestampBeyondMaxDrift } from "@evolu/common/local-first";
const isBeyondMaxDrift = isTimestampBeyondMaxDrift({
timestampConfig: { maxDrift: 10 },
});
const now = Millis.orThrow(100);
assertFalse(isBeyondMaxDrift(Millis.orThrow(110), now));
assertTrue(isBeyondMaxDrift(Millis.orThrow(111), now));