Skip to content

v1.6.0

Latest

Choose a tag to compare

@github-actions github-actions released this 24 Nov 05:11

✨ New

  • formatDuration(duration, { locale?, style?, smallest? }): "1 hour, 5 minutes", "1 hr, 5 min", "1h 5m" or "1:05:00", built on Intl.DurationFormat with a fallback for older runtimes. Pass milliseconds or { hours: 1, minutes: 5 }. Zero formats as "0 seconds". (#62, #109)

🐞 Fixes

  • parse month names now match the in-context (genitive) forms many languages use in dates, so format → parse round-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)

⚠️ Behavior change

  • parse now throws for an unknown month name (e.g. "Foo 6, 2024"). Previously it silently used the current month, which produced wrong dates. Wrap parse in try/catch if you accept free-form input. (@formkit/pro's datepicker already handles this since 0.134.1.)