npm / date-and-time
date-and-time
What changed in date-and-time 4, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-27.
1 breaking1 deprecations10 new APIs and options1 tooling7 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initdate-and-time 420 changes
Breaking changes 1
defaultDate.Z takes precedence over the timeZone option when both are present.
Deprecations 1
Class-based plugins are deprecated; plugin authors should consider the new object-literal plugin types.
New APIs and options 10
Object-literal plugin types were added, giving plugin authors a new way to define plugins.
parse() and isValid() accept a ParsedComponents object to provide fallback values for date/time components missing from the format string.
A standalone, reusable interface is available in parser.ts; PreparseResult now extends it.
A new utility function is available in the public API.
A new plugin provides quarter-of-year functionality.
A new plugin supports Unix timestamp seconds and milliseconds.
A new plugin provides ISO 8601 week formatting.
All date manipulation functions now support IANA timezone strings.
A new entry point lets developers import multiple timezones from a single module.
The format() function accepts IANA timezone name strings in addition to TimeZone objects.
Tooling 1
Type definitions were added, allowing developers to use the package with type information.
Fixes and other changes 7
CJS type definitions were fixed.
Invalid-input handling was fixed.
CommonJS default-export interop was fixed.
Fixed a parsing bug involving defaultDate and 12-24-hour parsing.
isValid() validates defaultDate components, and leap-day validation respects a defaultDate.Y context.
Timezone name mappings were corrected for Falkland, Greenland, Hawaii-Aleutian, Macao, and 10+ additions.
Fixes timezone offset range and month boundary handling.