Skip to content

Strange Types.date() behavior #14

@Louprenard

Description

@Louprenard

There is a possible unwanted behavior (and undocumented) in the Types.date() validation :

  • When it receives a valid date (ie: 2025-04-18), it correctly returns the expected Date object
  • When it receives a "invalid" date (ie: 2025-02-31), it returns the third of March instead of an error

This is probably due to the way Date is implemented in Javascript, but it is quite surprising to accept an invalid date and use it as an other one silently.

Note: moment('2025-02-31') returns an "Invalid date"

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