Skip to content

Date-Time validation allows non RFC3339 stringsΒ #247

@AryaSvitkona

Description

@AryaSvitkona

In https://github.com/thephpleague/openapi-psr7-validator/blob/master/src/Schema/TypeFormats/StringDateTime.php the four allowed formats are declared, which a passed date-time string should match.

According to the DateTimeInterface documentation the P in Y-m-d\TH:i:sP stands for

Difference to Greenwich time (GMT) with colon between hours and minutes

where an O would stand for

Difference to Greenwich time (GMT) without colon between hours and minutes

If I pass 2025-05-28T17:39:00+0200 (without colon) the method still returns true, since it would match the first format Y-m-d\TH:i:sP.
Why? I expected to return "false" since it does not match one of the declared formats.

I also checked the RFC3339 reference which leads to timezone offset with colons.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions