zod-joda
TypeScript icon, indicating that this package has built-in type declarations

1.1.3 • Public • Published

JS-Joda integration for Zod validation library

Node.js CI codecov

This library adds additional types to Zod to parse and validate dates and times as js-joda types.

Installation

  • Install the npm package:

    npm install zod-joda

  • Additionally, you should have both zod and js-joda installed:

    npm install zod @js-joda/core

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';

This library supplies the following types:

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

All constructors 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.

/zod-joda/

    Package Sidebar

    Install

    npm i zod-joda

    Weekly Downloads

    617

    Version

    1.1.3

    License

    BSD-2-Clause

    Unpacked Size

    16.4 kB

    Total Files

    18

    Last publish

    Collaborators

    • dasprid