Skip to content

RFC 3339 validator accepts invalid strings #1653

@jmacmahon

Description

@jmacmahon

Describe the bug
I was trying to validate RFC 3339 full-time type by appending it to an RFC 3339 full-date followed by T, to make an RFC 3339 date-time. In my tests I had previously been using full ISO strings for this field, and was surprised when the tests still passed.

https://tools.ietf.org/html/rfc3339#section-5.6

Examples

const v = require('validator')

const badString = '2021-01-01T' + new Date().toISOString()
// '2021-01-01T2021-04-21T12:00:12.644Z'
// This string is obviously not a valid RFC 3339 full-date, since it contains two instances of "T"

v.isRFC3339(badString)
// true

Additional context
Validator.js version: 13.5.2
Node.js version: 14.16.0
OS platform: macOS

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions