Currently browsing JavaScript Time & Date

Tutorials on working with dates and times in vanilla JavaScript — parsing, formatting, timezones, and performance. Covers the Date object, common pitfalls, duration calculations, and displaying times reliably across locales. Learn practical patterns for handling time correctly without reaching for a heavy library.

How to create time constants in JavaScript in a performant way

A recent project of mine required time constants, and instead of opting for an additional library for just 10 or…

Vanilla JavaScript table date sorting

Say we have a table with dates, in the following format: We want to sort this table dynamically based on…

How to add a top bar countdown for your next product sale

You can (probably) see this top bar right now, with a nice 30% off sale for my WordPress Lighthouse plugin.…

24-Hour Countdown with Progress Saving Using Vanilla JavaScript

Here’s an interesting JavaScript snippet allowing you to set a 24-hour countdown and save its progress between page loads.

Date Countdown Using Vanilla JavaScript

A while ago, I coded several date countdowns for several promotions. These countdowns went straight inside a third-party popup solution,…