Expiry Calculator
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.
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:
- One year, a year earlier — the same call from 2026 gives
31536000. - One year from 29 February — ends on 28 February 2029.
- One month from 31 January — the end clamps to 28 February.
- A 90-day signed URL — a length in days is the same from any start.
- A cookie that is already gone — a negative length, and Now refuses it.
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.