Prompt
false positives visual regression timestamps
Latest observation
Oct 27, 2026
OpenAI APIWeb search: off
If you’re seeing false positives in visual regression and the diffs are mostly around timestamps, the usual fixes are to make the timestamp deterministic or mask it out.
Common approaches
1) Freeze time in tests
Make the app render a fixed date/time during screenshots.
Examples:
- Set a mocked system clock
- Inject a fixed
now()value - Use environment-based test time
2) Stub dynamic timestamp formatting
If the UI shows things like:
just now2 min ago- local time strings
- timezone-dependent dates
then render a stable value in test mode, e.g.:
2026-01-01 12:00 UTC- or a static relative time
3) Mask the timestamp region
If the timestamp itself isn’t what you’re testing, hide or blur that element in the screenshot tool.
Common screenshot tools often support:
maskselectorsignoreElementshideSelectors
4) Normalize timezone and locale
Visual diffs can happen because of:
- timezone differences
- locale formatting
- daylight saving changes
Run tests with:
- fixed
TZ=UTC - fixed locale, like
en-US
5) Avoid live data in visual tests
If the page loads current timestamps from APIs, use:
- mocked API responses
- fixture data with static dates
Best practice
For visual regression, the most robust setup is usually:
- Mock time
- Fix timezone/locale
- Mask any remaining dynamic timestamps
If you want, I can give you:
- a Playwright example,
- a Cypress example,
- or a general checklist for eliminating timestamp-related visual diffs.
Brands