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.
Every (or at least a lot of) project seems to have code like this somewhere: if...
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.

advanceTimersByTime moves the clock but not the microtask queue. That mismatch is why your timer test hangs on a promise that…

I built date-light, a small zero-dependency date utility library for JavaScript and TypeScript. I...

I built Temporize because traditional debounce/throttle utilities don’t compose particularly well...

Every developer has had this moment. You need a date picker, so you start searching. You find one...

I built a small Unix timestamp converter — paste in seconds or milliseconds, get a date back, or go...

JavaScript's Date object has carried the web for decades, but almost every experienced developer has...