Skip to content

v3.1.0

Latest

Choose a tag to compare

@rendro rendro released this 22 Jul 21:01

Fixes found by an adversarial audit of 3.0.1.

  • start() was a silent no-op once the countdown had ended. Pushing the target back into the future with updateOffset() rendered a live value exactly once and then froze forever, reporting running === false. Only update() cleared the finished flag.
  • The jQuery plugin lost data-date precedence on re-invocation. It read the attribute only when creating an instance, so a second call over the same selection used the shared options date instead — and that is the standard "new content arrived, re-init everything" pattern the readme encourages.
  • A jQuery-initialised countdown leaked its interval when the element was removed. $(el).remove(), .empty() and .html() run jQuery's cleanData, which dropped the data entry without stopping the timer, leaving it writing into a detached node with the instance unreachable.
  • leadingZeros rounded up across the unit boundary. 59.999 seconds rendered as 60.00, the impossible value that flooring in getDiffDate exists to prevent — reachable straight from the readme's own decimal-seconds example. It truncates now.
  • leadingZeros padded in front of the minus sign, giving 0-5.
  • toDate() returned the caller's own Date, so mutating it afterwards moved the target.
  • easy-countdown/jquery now resolves for TypeScript consumers on moduleResolution: "node".

Seven new regression tests. The 2.x compatibility suite is unchanged and still passes.