Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation of datetime-local fails when oneOf is used #1534

Open
simontaurus opened this issue Apr 10, 2024 · 3 comments
Open

Validation of datetime-local fails when oneOf is used #1534

simontaurus opened this issue Apr 10, 2024 · 3 comments
Assignees

Comments

@simontaurus
Copy link

General information

Expected behavior

Validation should work both on direct assignment of format: datetime-local and assignment via oneOf: format: datetime-local

Actual behavior

Validation only works on direct assignment of format: datetime-local
Related: #1471

grafik

Steps to reproduce the behavior

Direct link to example: playground

{
  "title": "Time Validation test",
  "type": "object",
  "properties": {
    "datetime": {
      "type": "string",
      "title": "datetime-local",
      "format": "datetime-local",
      "options": {
        "flatpickr": {
          "dateFormat": "Z"
        }
      },
      "default": "2024-04-10T10:00:00.000Z"
    },
    "date_or_datetime": {
      "title": "date_or_datetime",
      "type": "string",
      "default": "2024-04-10T10:00:00.000Z",
      "oneOf": [
        {
          "title": "datetime-local",
          "format": "datetime-local",
          "options": {
            "flatpickr": {
              "dateFormat": "Z"
            }
          }
        },
        {
          "title": "date",
          "format": "date",
          "options": {
            "flatpickr": {
              "dateFormat": "Y-m-d"
            }
          }
        }
      ]
    }
  }
}
@schmunk42
Copy link
Collaborator

@simontaurus Which browser are you using?

@schmunk42
Copy link
Collaborator

And ... is flatpickr disabled in your screenshot? If I disable it, it looks like your image and - strangely - it's readonly.

CC: @germanbisurgi

@simontaurus
Copy link
Author

@schmunk42:

  • Firefox, but just reproduced it in Edge.
  • flatpickr is enabled but in the playground a click on "Update Schema" is required to get flatpickr loaded and default values applied. Disabling flatpickr throws some exceptions in the console caught error: TypeError: Cannot read properties of undefined (reading 'test'), see direct link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants