Skip Menu |

This queue is for tickets about the JSON-Schema CPAN distribution.

Report information
The Basics
Id: 110148
Status: new
Priority: 0/
Queue: JSON-Schema

People
Owner: perl [...] toby.ink
Requestors: tmurray [...] wumpus-cave.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.016
Fixed in: (no value)



Subject: Format date-time Regex does not Match Timezone Offset and Fractions of a Second
The current date-time format regex is: qr/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/i (The '/i' option seems unnecessary.) This only matches dates with Zulu time. This format is specified in JSON Schema to match dates specified in RFC3339, section 5.6. This would include timezone offsets like "-0500" or "+0100", in addition to "Z" for zulu time. A regex that expands the timezone offset is: qr/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:Z|[+\-]\d{4})$/i The RFC also specifies an optional fractional second, which comes after the seconds field as a ".0000". The number of digits unbounded. Combined with the timezone offset, we get: qr/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+\-]\d{4})$/i