ajv-formats
Check emails, dates and links in form data.
1. License
“to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software”
MIT allows use in paid and closed products.
github.com/ajv-validator/ajv-formats/blob/master/LICENSE3. Used by agents' projects
Dependency in 58 public GitHub projects set up for AI coding agents that we scanned (0.9%).
4. Agent access
Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.
From the package registry and GitHub, checked daily; card checked Nov 11, 2026. Tap a verdict to see its source.How we checkedReport an error
What ajv-formats does
ajv-formats is a small free add-on for Ajv, a JavaScript library that checks data against a written set of rules called a JSON Schema. Without it, Ajv cannot check rules such as "this must be an email" or "this must be a date". With it, your app can reject a bad email, an impossible date or a broken link before saving a form.
What people build with it
Check sign-up and contact forms
Your server checks that the email, the website address and the date a person typed have the right shape before it saves them.
Refuse bookings in the past
A booking form accepts only dates from today on, and the same schema gives the error text to show next to the field.
Check data from an AI model Idea
When a language model returns structured answers, your code checks that the dates, links and IDs in them are well formed before using them.
Match OpenAPI number and data types
If your service is described with OpenAPI, the same checks for 32-bit and 64-bit whole numbers and base64 data run on incoming requests.
Check server settings files Idea
Before a deploy, a script checks that every host name, IP address and link in a settings file is written correctly.
ajv-formats popularity
Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated
How ajv-formats is used
- ajv-formats is a dependency in 58 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (1.2% of the 4,867 JavaScript/TypeScript ones), #7 of 63 in forms, validation and schemas.
- Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 119; those are left out of every share on this page.
- Projects that use it most often also use Ajv (100.0%), jsdom (53.4%), js-yaml (36.2%).
- It is more common in projects set up for Kiro (5.7%) than for Cursor (0.7%).
By coding agent
Often used with
More about ajv-formats
Funding
- GitHub Sponsors: https://github.com/epoberezkin
- Open Collective: https://opencollective.com/ajv
- 15 GitHub sponsors
More in Forms, validation and schemas
Alternatives
ajv-formats This page
Pick Zod when you write your rules in TypeScript code rather than as JSON Schema and want the types to follow from them.
Pick Validator.js when you only need to check single strings, such as one email or URL, without a schema.
Pick jsonschema when your server is written in Python rather than JavaScript.
Get started
Tell your AI assistant
“Validate the booking form on the server with ajv 8.20.0 and ajv-formats 3.0.1 (call addFormats(ajv) with no options), using format email, uri and date plus formatMinimum set to today, and return each error message next to its field.”
Install Ajv and the formats add-on in your JavaScript project.
npm install ajv ajv-formatsFrom github.com/ajv-validator/ajv-formats/blob/master/README.md
Create Ajv and add the formats to it.
// ESM/TypeScript import import Ajv from "ajv" import addFormats from "ajv-formats" // Node.js require: const Ajv = require("ajv") const addFormats = require("ajv-formats") const ajv = new Ajv() addFormats(ajv)From github.com/ajv-validator/ajv-formats/blob/master/README.md
To add only some formats, pass their names.
addFormats(ajv, ["date", "time"])From github.com/ajv-validator/ajv-formats/blob/master/README.md
Mistakes to avoid
Ajv 7 and newer ship without the formats, and strict: false just skips the format check silently.
With an options object the comparison keywords are added only when keywords is true; in our run Ajv then threw "strict mode: unknown keyword: formatMinimum".
Fast mode checks only the shape; in our run "2026-02-30" passed the date format in fast mode and failed in full mode.
The url format is marked deprecated in the format list.
Standalone code checks that ajv-formats uses the same ajv as your app.
Questions
Why does Ajv say "unknown format" for my schema?
Since version 7, Ajv no longer includes the formats; add ajv-formats, or Ajv in strict mode stops at the unknown format.
Which formats does it add?
Dates and times, durations, URIs, email, host names, IPv4 and IPv6, regular expressions, UUIDs, JSON pointers and the OpenAPI number and data types.
What is the difference between the "full" and "fast" modes?
Full is the default. Fast uses simpler patterns and does not check date and time ranges, so February 30 passed in our run.
Can I use it in a paid product?
Yes, it is under the MIT license; keep its notice with copies of the code.