TLDR Web Dev · ARTICLES & TUTORIALS

HOW LONG IS A SECOND IN JAVASCRIPT?

docs.timetime.in7 min read

Summary from the TLDR Web Dev newsletter

Time in Javascript can be complex since its timekeeping (based on POSIX time) differs from Coordinated Universal Time (UTC). POSIX time ignores leap seconds, simplifying calculations but causing inaccuracies in applications that need precise time synchronization, unlike UTC which incorporates leap seconds to align with Earth's rotation. Two methods for handling leap seconds within POSIX systems are "step adjustment" (abruptly shifting time) and "smearing" (gradually distributing the adjustment).