-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Describe the bug
Required field validation. if the value is date object then the required field validation is failing
Version/Branch
What release version or branch are you experiencing the behavior?
"@formio/angular": "^10.0.0",
"@formio/js": "^5.2.5",
To Reproduce
Onloading the page setting the value from calculatedValue
{
"key": "expiryDate1",
"type": "datetime",
"input": true,
"label": "Expiry Date",
"format": "dd-MM-yyyy",
"widget": {
"type": "calendar",
"displayInTimezone": "submission",
"locale": "en",
"useLocaleSettings": true,
"allowInput": true,
"mode": "single",
"enableTime": false,
"noCalendar": false,
"format": "dd-MM-yyyy",
"hourIncrement": 1,
"minuteIncrement": 1,
"time_24hr": true,
"minDate": null,
"disableWeekends": false,
"disableWeekdays": false,
"maxDate": null
},
"bindPath": {
"dataType": "date",
"isReadOnly": false,
"propertyName": "policy.expirationDate",
"overrideBasePath": false
},
"tabindex": "2",
"validate": {
"required": true
},
"tableView": false,
"datePicker": {
"disableWeekdays": false,
"disableWeekends": false
},
"enableTime": false,
"timePicker": {
"showMeridian": false
},
"clearOnHide": false,
"customClass": "full-width",
"eventHandling": {
"eventType": [],
"eventScript": ""
},
"calculateValue": "const effectiveDate = .get(data, 'effectiveDate1');\nconst expiryDate = .get(data, 'expiryDate1');\nconst expirationDate = .get(data, 'policy.expirationDate');\n\nif (!expirationDate) {\n const dateMoment1 = moment(effectiveDate);\n const dateMoment2 = moment(expiryDate);\n const isLeapYear = dateMoment2.isLeapYear() || dateMoment1.isLeapYear();\n const daysToAdd = isLeapYear ? 366 : 365;\n let defaultExpiryDate = dateMoment1.add(daysToAdd, 'days');\n value = defaultExpiryDate;\n}",
"customConditional": "show = !((.get(data,"policy.policyStage") === 'Quote') || (.get(data,"policy.policyStage") === 'Bind') || (.get(data,"policy.policyStage") === 'Inforce') || (.get(data,"policy.policyStage") === 'Inactive'));",
"displayInTimezone": "submission",
"useLocaleSettings": true,
"customDefaultValue": "if(.get(data,"policy.expirationDate")){\n value = _.get(data,"policy.expirationDate");\n}",
"enableMaxDateInput": false,
"enableMinDateInput": false,
"validateWhenHidden": false,
"allowCalculateOverride": true
}
Expected behavior
It should not show any error message.
Screenshots
Additional context
Add any other context about the problem here.