/** * A controllable time source for use within the Firestore mock. * * This utility enables deterministic and testable control over "system time" as perceived * by the mock Firestore implementation. By default, `SystemTime` returns the real current * time (`new Date()`), but developers can override this behavior to return a fixed timestamp * or a dynamic value with a specified offset. * * @example * const time = new SystemTime(); * time.constant(new Date('2020-01-01T00:00:00Z')); * console.log(time.now()); // Always returns the same date * * time.system(); * console.log(time.now()); // Returns real current time * * time.offset(new Date('2023-01-01T00:00:00Z')); * // Returns a date that tracks the same delta as real time since this offset root */ export declare class SystemTime { /** @internal The generator function used to return the current system time. */ private _generator; /** * Returns the current time according to the active generator strategy. * * @returns A `Date` instance representing "now" from the perspective of the configured time strategy. */ now(): Date; /** * Locks the internal time to a constant value. All calls to `now()` will return a copy * of the provided date. * * @param date - A `Date` object to fix as the current time. */ constant(date: Date): void; /** * Resets the time source to real system time. All calls to `now()` will return `new Date()`. */ system(): void; /** * Sets the time source to a moving offset from a fixed root date. * * The returned time increases in real time, starting from the `root` date. * Internally, this preserves the delta between the original root and real system time * when the method was invoked. * * @param root - A `Date` instance representing the base time to start offsetting from. */ offset(root: Date): void; /** * Sets the time source to a moving offset from a root date constructed from parts. * * @param year - The full year (e.g., 2024) * @param month - The month (0-based, January is 0) * @param day - The day of the month (1-based). Defaults to 1. * @param hour - The hour. Defaults to 0. * @param minute - The minute. Defaults to 0. * @param second - The second. Defaults to 0. * @param millisecond - The millisecond. Defaults to 0. */ offset(year: number, month: number, day?: number, hour?: number, minute?: number, second?: number, millisecond?: number): void; /** * Advances the current time by the specified number of milliseconds. * * This method is useful in tests where deterministic progression of time is needed. * Internally, it retrieves the current "now" from the active generator, adds the * given number of milliseconds, and reconfigures the time source using `offset()` * so that real time continues from the new advanced timestamp. * * If no value is provided, the time is advanced by 1 millisecond. * * @example * const time = new SystemTime(); * time.constant(new Date('2020-01-01T00:00:00Z')); * time.advance(1000); * console.log(time.now()); // 2020-01-01T00:00:01.000Z * * @param millis - The number of milliseconds to advance time by. Defaults to 1. */ advance(millis?: number): void; /** * Replaces the internal time generator with a custom implementation. * * This allows test environments to simulate arbitrary time behavior— * including randomized timestamps, scheduled sequences, or other * domain-specific time simulations. * * @example * let counter = 0; * time.custom(() => new Date(Date.UTC(2020, 0, counter++))); * * @param generator - A function that returns a `Date` object representing the current time. */ custom(generator: () => Date): void; } //# sourceMappingURL=system-time.d.ts.map