Skip to content

Tuple of date-time does not allow Date #662

Closed
@qwelias

Description

@qwelias

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Fastify version

latest

Plugin version

No response

Node.js version

20

Operating system

Linux

Operating system version (i.e. 20.04, 11.3, 10)

Arch

Description

Throws on stringifying Date for schema with {type: 'string',format: 'date-time'}

Steps to Reproduce

require('./index.js')({
  title: 'dates tuple',
  type: 'object',
  properties: {
    dates: {
      type: 'array',
      minItems: 2,
      maxItems: 2,
      items: [
        {
          type: 'string',
          format: 'date-time'
        },
        {
          type: 'string',
          format: 'date-time'
        }
      ]
    }
  }
})({
  dates: [new Date(1), new Date(2)]
}) // Error: Item at 0 does not match schema definition.

Expected Behavior

Does not throw on stringifying Date for schema with {type: 'string',format: 'date-time'}

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