Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

zod-joda

dasprid11kBSD-2-Clause2.0.1TypeScript support: included

JS-Joda integration for Zod validation library

Zod, js-joda, validation, joda, TypeScript

readme

JS-Joda integration for Zod validation library

Release codecov

This library adds additional types for Zod to parse and validate dates, times and durations as js-joda types. This library has support for both zod v4 and zod/v4/mini.

Installation

npm install zod-joda @js-joda/core zod

Quick Start

Import the schema types from this package. You can either import individual types or import all types via convenience method:

import {zj} from 'zod-joda';

For zod/v4/mini, import from the mini sub-path:

import {zj} from 'zod-joda/mini';

This library supplies the following types:

  • zj.duration()
  • zj.localDate()
  • zj.localDateTime()
  • zj.localTime()
  • zj.zonedDateTime()

All constructors except duration take an optional object with a dateTimeFormatter property, which allows you to change the default behavior of how dates and times will be parsed. By default, every value should be in an ISO 8601 format.

changelog

2.0.1 (2025-06-10)

Bug Fixes

  • properly support toJSONSchema (b9f2515)

2.0.0 (2025-06-09)

Features

BREAKING CHANGES

  • Starting with this release, this library now requires zod v4.