Stephen
September 3, 2016, 9:58pm
1
Is this the correct way to describe a 4 character year field in a JSON Table Schema?
{
"name": "year",
"description": "Year data was collected in e.g. 2016",
"type": "date",
"format": "fmt: %Y",
"constraints": {
"required": true
}
Yes, this is the correct way to specify a 4 character year field in a JSON Table Schema.
The use of the fmt:
prefix here is currently under discussion for removal. Here is the issue: Remove `fmt:` prefix for date formats · Issue #260 · frictionlessdata/specs · GitHub
edit: maybe remove the space between the %Y
and the fmt:
1 Like
Stephen
September 3, 2016, 10:17pm
3
Thanks @danfowler . It’s confusing as when I use CSVLint to validate the data, this works:
{
"name": "year",
"description": "Year data was collected in e.g. 2016",
"constraints": {
"required": true,
"type": "http://www.w3.org/2001/XMLSchema#gYear"
}
Looks like CSVLint and GoodTables are not 100% aligned.
1 Like
Stephen
September 3, 2016, 11:26pm
4
GoodTables says, “No” using…
{
"name": "YEARS",
"description": "Year data was collected in e.g. 2016",
"type": "date",
"format": "fmt: %Y",
"constraints": {
"required": true
}
Using this data uploaded from local file (issues when accessing via URL).
Any clues?
Can you try removing the space between the fmt:
and the %Y
?
"fields": [
{
"name": "YEARS",
"description": "Year data was collected in e.g. 2016",
"type": "date",
"format": "fmt:%Y",
"constraints": {
"required": true
}
}
]
1 Like