v1.6.0
formatDuration(duration, { locale?, style?, smallest? }): "1 hour, 5 minutes", "1 hr, 5 min", "1h 5m" or "1:05:00", built onIntl.DurationFormatwith a fallback for older runtimes. Pass milliseconds or{ hours: 1, minutes: 5 }. Zero formats as "0 seconds". (#62, #109)
parsemonth names now match the in-context (genitive) forms many languages use in dates, soformat→parseround-trips in ru, pl, uk, cs, sk, fi, lt, hr, zh, ko and more. Matching is case/whitespace-lenient like other literals ("JANUARY 6, 2024"). Thanks @jayhemnani9910! (#92)
parsenow throws for an unknown month name (e.g."Foo 6, 2024"). Previously it silently used the current month, which produced wrong dates. Wrapparsein try/catch if you accept free-form input. (@formkit/pro's datepicker already handles this since 0.134.1.)
v1.5.0
New helpers, timezone fixes and a big thank-you to @bardrop 🙌
relative(date, { base?, locale?, numeric?, style?, unit? }): "5 minutes ago", "yesterday", "in 3 weeks", "dans 3 ans". A thin layer overIntl.RelativeTimeFormatthat picks the unit for you. Hours use the wall clock, days count calendar dates (so DST and skipped midnights don't shift them), and months/years are completed units likediffMonths/diffYears. Amounts are truncated toward zero; zero keeps its direction ("0 seconds ago"). (#7, #108)weekNumber(date?, startOfWeekDay = 1, firstWeekContainsDate = 4): week of the year, ISO 8601 by default (2024-12-30→ 1).weekNumber(d, 0, 1)gives US-style Sunday weeks. (#44, #105)isBefore(null, date)/isAfter(null, date)type-check ("is now before…?"), matchingisEqual. (#56, #107)
tzDateuses the target zone's offset at the target time, so wall times around DST changes convert correctly (e.g. local timestamps around Berlin's switch). (#96 by @bardrop, fixes #74)format(…, "Z")withouttzprints the offset of the actual instant. For the first hours after each DST change it printed the previous offset (03:30 -05:00instead of-04:00in New York), and historical second-precision offsets lost their seconds (Detroit 1904-05:32:11), so format → parse round-trips were off by 11s. (#67, #106)diffMonths/diffYears: on a clamped month-end anniversary (Jan 31 → Feb 28) the time of day is now respected.Jan 31 23:00 → Feb 28 01:00is 0 months (was 1). (#108)
- The
diffMonths/diffYearsmonth-end fix above changes results only in that exact case (374 of 200,000 random pairs). formatdevice offsets now differ from 1.4.0 only where 1.4.0 was wrong (checked againstIntlevery ~4h from 1990–2030 in 5 zones).
v1.4.0
A batch of community fixes 🙌 — thank you @jayhemnani9910, @pcbeingused333, @imsurya26!
diffDays/diffWeekscount calendar days across DST (#93):diffDays("2026-03-15", "2026-03-01")is now 14 in DST zones (was 13). Days are counted on the device's wall clock, likeaddDayanddiffMonths, so two instants exactly 14×24h apart across a fall-back now count 13 days.diff()follows suit.diffHoursstays elapsed time.diffMonthsrespects time of day (#104):2024-03-15T09:00vs2024-02-15T10:00is 0 months (a few hours short), was 1. Date-only inputs are unchanged. Flows intodiffYearsanddiff().
nearestDaywithmonth/week/yearconstraints no longer returns a day from the previous period (#91)dayOfYearcounts calendar days across skipped dates (e.g. Pacific/Apia 2011) (#97)hourStart/hourEnd/minuteStart/minuteEndstay in the same occurrence of a repeated (fall-back) hour (#102)diffWeeks(date)/diffWeeks(null, date)type-check, comparing with now (#101)
v1.3.0
- parse: Allow numeric literals between fixed-width parts - by @justin-schroeder in https://github.com/formkit/tempo/issues/103 (04666)
v1.2.0
- parse: Reject mismatched literals and trailing characters - by @justin-schroeder in https://github.com/formkit/tempo/issues/100 (1bef0)
v1.1.2
- Parse m/s tokens, accept every iso8601() shape in date(), native-digit padding, export sameMonth - by @justin-schroeder in https://github.com/formkit/tempo/issues/98 (dd1bb)
v1.1.1
- Add Braid site attribution link to footer - by @andrew-boyd (0eddc)
- Parse ISO dates with a year before 1000 - by @Osamaali313 in https://github.com/formkit/tempo/issues/85 (371de)
- format: Use Intl.Locale to merge hourCycle into locale with existing Unicode extensions - by @crossi-dev in https://github.com/formkit/tempo/issues/68 and https://github.com/formkit/tempo/issues/84 (22050)
- yearDays: Return whole days regardless of time zone - by @pcbeingused333 in https://github.com/formkit/tempo/issues/87 (b6d8a)
v1.0.0
- Optional date arguments for functions - by @WilcoSp in https://github.com/formkit/tempo/issues/58 (a748d)
- Add millisecond support to format, parse, and helpers - by @justin-schroeder (9671e)
- Update pnpm-lock.yaml to lockfileVersion 9.0 - by @andrew-boyd (b91c1)
- Update pnpm-lock.yaml to lockfileVersion 9.0 - by @justin-schroeder (a6502)
- Support seconds precision in timezone offsets - by @justin-schroeder in https://github.com/formkit/tempo/issues/67 (c1d55)
- Improve search modal performance and styling - by @justin-schroeder (1e285)
- Add packageManager field for pnpm version - by @justin-schroeder (184e7)
- Flaky test and Vercel build compatibility - by @justin-schroeder (848da)
v0.1.2
- Timezone offsets in 1904 - by @justin-schroeder in https://github.com/formkit/tempo/issues/59 (eb315)