Skip to content

Commit 6aa84c8

Browse files
committed
allow leap second in ISO 8601 Timestamp
Also clarify in testing that we require unambiguous time zones (SHOULD* requirement)
1 parent 44606ca commit 6aa84c8

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

spec/cljx/xapi_schema/schemata/json_spec.cljx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,11 @@
123123
(it "is a valid ISO 8601 DateTime"
124124
(should-satisfy+ Timestamp
125125
"2014-09-10T14:12:05Z"
126+
"2015-06-30T23:59:60Z" ;; leap second
126127
:bad
127-
"09-10-2014T14:12:00+500")))
128+
"09-10-2014T14:12:00+500"
129+
"2014-09-12T03:47:40" ;; no time zone
130+
)))
128131
(describe
129132
"Duration"
130133
(it "is a valid ISO 8601 Duration"

src/cljx/xapi_schema/schemata/regex.cljx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#"[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-4[0-9A-Za-z]{3}-[89ABab][0-9A-Za-z]{3}-[0-9A-Za-z]{12}")
2323

2424
(def TimestampRegEx
25-
#"^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$")
25+
#"^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)|T23:59:60Z)?)?$")
2626

2727
(def xAPIVersionRegEx
2828
#"^1\.0\.(\d+)?$")

0 commit comments

Comments
 (0)