2

I've got this form with react-jsonschema-form

{
  "type": "object",
  "required": ["startDate", "endDate"],
  "properties": {
    "endDate": {
      "type": "string",
      "title": "Do",
      "format": "date"
    },
    "startDate": {
      "type": "string",
      "title": "Od",
      "format": "date"
    },
    "allDay": {
      "type": "boolean",
      "title": "All day",
      "default": true
    }
  }
}

And I want to change the format of the fields based on the checkbox, something like this:

{
  "type": "object",
  "required": ["startDate", "endDate"],
  "properties": {
    "endDate": {
      "type": "string",
      "title": "Do",
      "format": "date"
    },
    "startDate": {
      "type": "string",
      "title": "Od",
      "format": "date"
    },
    "allDay": {
      "type": "boolean",
      "title": "All day",
      "default": true
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "allDay": false
        }
      },
      "then": {
        "properties": {
          "endDate": {
            "format": "date-time"
          },
          "startDate": {
            "format": "date-time"
          }
        },
        "required": ["startDate", "endDate"]
      }
    }
  ]
}

But it doesn't seem to work. I know that it can be done via a selectbox, but I want to use the checkbox.

Are there any possibilities to this problem?

0 Answers0