Skip to content

Expiry Calculator

  • The core functions, which every industry uses.

A cookie, a token and a signed URL each want the same length of time in a different form. Type an amount and a unit, then pick a start: a date you type or drag, or Now. The four plates show the cookie Max-Age, the Expires header, the JWT exp and the signed-URL time. The table sets twelve monthly starts beside the number most code hard-codes. Every date and length on the page is a library result except that hand-written number.

Length and start

From 15 June 2027 a year ends in 2028, a leap year, so it is 366 days long.

Start

A date is pinned: the four plates come from the start below, and the same start always gives the same answer.

An ISO time in UTC, such as 2027-06-15T12:00:00Z.

The same length, four ways

Cookie Max-Age
no result
Expires
no result
JWT exp
no result
Signed-URL time
no result

No result There is no result to compare.

The next 12 starts

The starts count from the start above.

Length from each of the next 12 starts
StartEndsSecondsAgainst the fixed number
no resultno resultno resultno result
no resultno resultno resultno result
no resultno resultno resultno result
no resultno resultno resultno result
no resultno resultno resultno result
no resultno resultno resultno result
no resultno resultno resultno result
no resultno resultno resultno result
no resultno resultno resultno result
no resultno resultno resultno result
no resultno resultno resultno result
no resultno resultno resultno result

Now. ttlFromNow reads the clock once and gives the length in every form, so the four plates name one instant. Past year 9999 it returns null for the whole result, because an HTTP date has no four-digit form. The pure date route is the same length from a start you choose, and the same start always gives the same answer.

Cookie Max-Age. totalDuration with relativeTo counts a year or a month from the start it is given. From Now, totalUnitsFromNow does the same for seconds or any one unit, and takes a timeZone. A day counted in UTC is always 86,400 seconds.

Expires. formatHttpDate writes the header, and formatHttpDateFromNow writes it for a length from Now.

JWT exp. addUnix adds the length to a Unix epoch. getUnixIn gives the epoch for a length from Now.

Signed-URL time. addUtc adds the length to a UTC time, and getUtcIn gives it from Now.

A past Expires and a Max-Age of zero or less delete a cookie (RFC 6265). That is why Now refuses a negative length and the pure route does not.

See a length of time counted from now.

Worth trying:

Code examples: MIT-0. Packages: MIT. Third-party data and components: their own licences, credited where they appear. Everything else:© 2026 NorthGuild, all rights reserved.