Closed renevoorburg closed 4 months ago
Could you provide a minimal example to reproduce?
Never mind, found it. The datetime-local html input field omits the seconds part completely in case they are 0.
v1.4.6 fixes this by converting the value to xsd:dateTime via new Date(value).toISOString().slice(0, 19)
Great!
For the sake of completeness, this example doesn't validate now while it should. Adding one second to the data time will make it pass.
<html>
<head>
<script
src="https://cdn.jsdelivr.net/npm/@ulb-darmstadt/shacl-form/dist/form-default.js"
type="module"
></script>
</head>
<body>
<shacl-form
data-shape-subject="http://www.nationaalarchief.nl/mdto-shacl#EventGegevensShape"
data-shapes="
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix mdto: <http://www.nationaalarchief.nl/mdto#> .
@prefix mdtosh: <http://www.nationaalarchief.nl/mdto-shacl#> .
mdtosh:EventGegevensShape
a sh:NodeShape ;
sh:targetClass mdto:EventGegevens ;
sh:property [
a sh:NodeShape ;
sh:path mdto:eventTijd ;
sh:datatype xsd:dateTime ;
sh:name 'Date time'
].
" data-values="
@prefix mdto: <http://www.nationaalarchief.nl/mdto#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix ex: <http://www.example.com/> .
ex:Event001
a mdto:EventGegevens ;
mdto:eventTijd '2020-01-12T23:20:00'^^xsd:dateTime .
" data-values-subject="http://www.example.com/Event001"
></shacl-form>
<script>
const form = document.querySelector("shacl-form");
form.addEventListener("change", (event) => {
if (event.detail?.valid) {
const triples = form.serialize();
console.log("entered form data", triples);
}
});
</script>
</body>
</html>
Just check once more, it should work now. It takes a while for the CDN to update to the latest version of this library. Alternatively you can request a specific version like so: https://cdn.jsdelivr.net/npm/@ulb-darmstadt/shacl-form@1.4.6/dist/form-default.js
Now it works as expected. Thank you!
An rdf that is validated by https://www.itb.ec.europa.eu/shacl/any/upload gives an validation error in the generated form. The triple that fails is:
It does validate when I change it to:
To my knowledge, the former is valid too.