Every (or at least a lot of) project seems to have code like this somewhere:
if (user.subscriptionEndsAt < new Date()) {
// ...
}
There's nothing wrong with it... until you have to test it.
Then you end up freezing time, mocking Date, enabling fake timers, remembering to restore them afterwards, and hoping another test didn't leave the...
🔧 Programmierung
⚡ iShareStuff Intelligence
📰 VERIFIED NEWS INTELLIGENCE ID: #3676253
🔧 I got tired of mocking Date, so I built a TimeProvider for TypeScript
⏱️ vor 1h 12m (04.08.2026 um 23:03 Uhr) 📖 2 Min. Lesezeit 📂 🔧 Programmierung 📡 Feed 🔗 Quelle: dev.to
Schrift:
Verwandte Videos & News · KI-empfohlen via Levenshtein-Match
🎯 38% Match
📆 25.04.2025 um 00:00 Uhr
▶ Abspielen
🎯 33% Match
📆 21.07.2025 um 21:00 Uhr
▶ Abspielen
🎯 31% Match
📆 23.11.2024 um 18:54 Uhr
▶ Abspielen
🎯 31% Match
📆 06.12.2023 um 16:09 Uhr
▶ Abspielen
🎯 31% Match
📆 24.04.2025 um 21:00 Uhr
▶ Abspielen
🎯 31% Match
📆 11.03.2025 um 19:01 Uhr
▶ Abspielen
🎯 31% Match
📆 21.05.2024 um 20:16 Uhr
▶ Abspielen
🎯 28% Match
📆 13.07.2020 um 17:59 Uhr
▶ Abspielen
← Horizontal scrollen für mehr Empfehlungen → · Klick auf ein Video zum Abspielen im Hauptplayer