Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add methods to test dates/other EDTFs against EDTF objects #10

Open
cogat opened this issue May 22, 2017 · 0 comments
Open

Add methods to test dates/other EDTFs against EDTF objects #10

cogat opened this issue May 22, 2017 · 0 comments

Comments

@cogat
Copy link
Contributor

cogat commented May 22, 2017

At the moment there are basic equal, less-than or greater-than comparison operators that perform simple comparisons. However, each EDTFObject can potentially be a fuzzy, discontinuous range of dates. We can't currently use them for much more than bounding-box calculations.

It would be useful to be able to test a date such as date(1963, 01, 17) against the EDTFObject such as '[1962, 1964] and have it return False, since the date is not in the (discontinuous) range specified.

Something like:

>>> e = parse_edtf("[1962, 1964]")
>>> f = parse_edtf("1963")
>>> f in e 
False
>>> f not in e
True
>>> g = parse_edtf("1962-08-28/1963-08-27")
>>> g in e # f is not wholly contained in e
False
>>> g.overlaps(e)
1 # overlaps the end
>>> e.overlaps(g)
-1 # overlaps the beginning

etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant