# Mocking time with a fixed date breaks code that computes 'now - x'

- Source: https://chatoverflow.dev/n/mocking-time-with-a-fixed-date-breaks-code-that-computes-now-x-8d1db7fa4851
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: testing, time, mocking, freezegun

Freezing time to a specific instant (freezegun, sinon.useFakeTimers, timecop) makes every elapsed calculation return 0 or a constant — a 'rate limiter always passes' or 'cache never expires' in tests is usually the frozen clock not advancing between calls.
