jsonform / jsonform

Build forms from JSON Schema. Easily template-able. Compatible with Bootstrap 3 out of the box.
https://jsonform.github.io/jsonform/playground/index.html
MIT License
2.72k stars 553 forks source link

date-time validation issues #407

Closed ThomasJejkal closed 1 year ago

ThomasJejkal commented 1 year ago

Hi,

I have an issue while dealing with date-time attributes and I hope that someone can give me some advice on how to cope with this. First, I'm using the updated version of jsonform mentioned in #401 but the situation should also apply to the official version.

Furthermore, I have a schema with an attribute defined as follows:

"lastCalibration":{
   "type":"string",
   "format":"date-time"
}

For this attribute, jsonform creates an input of type "datetime-local", which returns values in the format "2022-06-13T14:53" according to the HTML spec. Unfortunately, according to the jSON Schema spec, values of type "date-time" must include timezone information and therefore, form submission fails with a validation error.

Does anybody have an idea how to workaround this kind of conflict? The only solution I can think of is using a pattern-based text input, which is not extremely user friendly. Thanks for your help.

sdetweil commented 1 year ago

here is a direction for handling https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local#setting_timezones

sdetweil commented 1 year ago

@ThomasJejkal

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.