-
Notifications
You must be signed in to change notification settings - Fork 223
Open
Labels
enhancementNew feature or requestNew feature or request
Description
malli.experimental.time/schemas already supports java.time objects, but it would be convenient if there was a pre-defined set of ISO 8601 string schemas, so I could validate "2025-10-31T14:28:Z" without having to transform it to a java.time object first.
Currently, I can either try to transform the string to a java.time.*, and get unhelpful messages in case of validation errors (cf. #1114), or I can validate using my own hand-crafted regexp:
(ns repro
(:require
[malli.core :as m]
[malli.error :as me]))
(def offset-date-time-string
"Malli schema for ISO 8601 extended format date time"
[:re {:error/message "should be an ISO 8601 extended format date time"}
#"^\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d(\.\d\d\d)?([+-][0-2]\d:[0-5]\d|Z)$"])
(me/humanize (m/explain offset-date-time-string "2025-10-31T14:28:Z"))
;=> ["should be an ISO 8601 extended format date time"]Adding string schemas might already be a first step towards #60, too.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Type
Projects
Status
Not right now