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

minimum and maximum validations do not work in RJSF JSON FORM DATE PICKER COMPONENT #4517

Open
4 tasks done
Yash-Kr opened this issue Mar 6, 2025 · 0 comments
Open
4 tasks done
Labels
bug needs triage Initial label given, to be assigned correct labels and assigned

Comments

@Yash-Kr
Copy link

Yash-Kr commented Mar 6, 2025

Prerequisites

What theme are you using?

mui

Version

5.18.3

Current Behavior

Issue : minimum and maximum validations do not work in RJSF JSON FORM DATE PICKER COMPONENT

This is an existing issue with the RJSF library itself.

  • The RJSF schema expects minimum and maximum to be number.

  • However, the html element with type = ‘date’ expects min to be a string of format ‘yyyy-mm-dd’ Check here

Case 1 : In the RJSF schema, if we pass minimum = dayjs().format(“YYYY-MM-DD”) i.e. a string. The datePicker works as expected but while submitting the form validation error is thrown

schema is invalid: data/properties/startDate/minimum must be number, data/properties/endDate/minimum must be number

Case 2 : If we try converting the minimum to number something like this dayjs().valueOf() -> then validation works fine but datePicker wont work as expected because min will be number and wont work on (Refer below screenshots)

Image
Image

Image

Expected Behavior

No response

Steps To Reproduce

JSON SCHEMA :

{
    type: "object",
    required: ["startDate"],
    properties: {
      startDate: {
        type: "string",
        title: "Start Date",
        format: "date", // Ensures only YYYY-MM-DD format
        minimum: dayjs().format("YYYY-MM-DD")
        default: dayjs().format("YYYY-MM-DD")
      },
    }
  }

Environment

- OS:
- Node:
- npm:

Anything else?

No response

@Yash-Kr Yash-Kr added bug needs triage Initial label given, to be assigned correct labels and assigned labels Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug needs triage Initial label given, to be assigned correct labels and assigned
Projects
None yet
Development

No branches or pull requests

1 participant