Skip to content

Define min/max constraint for date type field? #583

Answered by roll
BenPortner asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @BenPortner,

The constraint should follow the data type and format so for your date column it will be 2020-01-01.

BTW there is the year data type available - https://specs.frictionlessdata.io/table-schema/#types-and-formats. So you can have:

{
    'name': 'Date',
    'description': 'Reference date between 1950 and 2100.',
    'type': 'year',
    'constraints': {
        'required': True,
        'minimum': 1950,
        'maximum': 2100,
    }
}

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by sglavoie
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #582 on March 04, 2021 18:00.