Skip to content

Commit 63a1573

Browse files
committed
Add docs about qualification properties
1 parent 5818557 commit 63a1573

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,50 @@ One can interpret uncertain or approximate dates as 'plus or minus a [level of p
342342

343343
If a date is both uncertain __and__ approximate, the padding is applied twice, i.e. it gets 100% * 2 padding, or 'plus or minus two [levels of precision]'.
344344

345+
### Qualification properties
346+
EDTF objects support properties that provide an overview of how the object is qualified:
347+
- `.is_uncertain (?)`
348+
- `.is_approximate (~)`
349+
- `.is_uncertain_and_approximate (%)`
350+
These properties represent whether the any part of the date object is uncertain, approximate, or uncertain and approximate. For ranges, the properties are true if any part of the range (lower or upper section) is qualified as such. A date is not necessarily uncertain and approximate if it is separately both uncertain and approximate - it must have the "%" qualifier to be considered uncertain and aproximate.
351+
```python
352+
>>> parse_edtf("2006-06-11")
353+
Date: '2006-06-11'
354+
>>> parse_edtf("2006-06-11").is_uncertain
355+
False
356+
>>> parse_edtf("2006-06-11").is_approximate
357+
False
358+
359+
>>> parse_edtf("1984?")
360+
UncertainOrApproximate: '1984?'
361+
>>> parse_edtf("1984?").is_approximate
362+
False
363+
>>> parse_edtf("1984?").is_uncertain
364+
True
365+
>>> parse_edtf("1984?").is_uncertain_and_approximate
366+
False
367+
368+
>>> parse_edtf("1984%").is_uncertain
369+
False
370+
>>> parse_edtf("1984%").is_uncertain_and_approximate
371+
True
372+
373+
>>> parse_edtf("1984~/2004-06")
374+
Level1Interval: '1984~/2004-06'
375+
>>> parse_edtf("1984~/2004-06").is_approximate
376+
True
377+
>>> parse_edtf("1984~/2004-06").is_uncertain
378+
False
379+
380+
>>> parse_edtf("2004?-~06-~04")
381+
PartialUncertainOrApproximate: '2004?-~06-~04'>>> L2_PartialUncertainOrApproximate.is_approximate
382+
True
383+
>>> parse_edtf("2004?-~06-~04").is_uncertain
384+
True
385+
>>> parse_edtf("2004?-~06-~04").is_uncertain_and_approximate
386+
False
387+
```
388+
345389
### Seasons
346390

347391
Seasons are interpreted as Northern Hemisphere by default. To change this, override the month mapping in `appsettings.py`.

0 commit comments

Comments
 (0)