Skip to content

Commit 1cb41b0

Browse files
committed
Update formatting examples and clarify current limitations
resolves #102
1 parent e450a01 commit 1cb41b0

1 file changed

Lines changed: 16 additions & 13 deletions

File tree

README.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44

55
**undate** is a python library for working with uncertain or partially known dates.
66

7-
It was initially created as part of a [DH-Tech](https://dh-tech.github.io/) hackathon in November 2022.
8-
97
> [!WARNING]
10-
> This is pre-alpha software and is **NOT** feature complete! Use with caution.
8+
> This is pre-alpha software and is **NOT** feature complete! Use with caution.
9+
> Currently it only supports parsing and formatting dates in ISO8601 format and
10+
> some portions of EDTF (Extended Date Time Format).
11+
12+
*Undate was initially created as part of a [DH-Tech](https://dh-tech.github.io/) hackathon in November 2022.*
1113

1214
---
1315

@@ -84,7 +86,7 @@ False
8486
False
8587
```
8688

87-
For dates that are imprecise or partially known, `undate` calculates earliest and latest possible dates for comparison purposes so you can sort dates and compare with equals, greater than, and less than. You can also compare with python `datetime.date` objects.
89+
For dates that are imprecise or partially known, `undate` calculates earliest and latest possible dates for comparison purposes so you can sort dates and compare with equals, greater than, and less than. You can also compare with python `datetime.date` objects.
8890

8991
```python
9092
>>> november7_2020 = Undate(2020, 11, 7)
@@ -137,19 +139,20 @@ An `UndateInterval` is a date range between two `Undate` objects. Intervals can
137139
31
138140
```
139141

140-
You can initialize `Undate` or `UndateInterval` objects by parsing a date string with a specific formatter.
142+
You can initialize `Undate` or `UndateInterval` objects by parsing a date string with a specific converter, and you can also output an `Undate` object in those formats.
143+
Available converters are "ISO8601" and "EDTF" (but only)
144+
141145
```python
142-
>>> from undate.dateformat.iso8601 import ISO8601DateFormat
143-
>>> isoformatter = ISO8601DateFormat()
144-
>>> isoformatter.parse("2002")
146+
>>> from undate import Undate
147+
>>> Undate.parse("2002", "ISO8601")
145148
<Undate 2002>
146-
>>> isoformatter.parse("2002-05")
149+
>>> Undate.parse("2002-05", "EDTF")
147150
<Undate 2002-05>
148-
>>> isoformatter.parse("--05-03")
149-
<Undate --05-03>
150-
>>> isoformatter.parse("--05-03")
151+
>>> Undate.parse("--05-03", "ISO8601")
151152
<Undate --05-03>
152-
>>> isoformatter.parse("1800/1900")
153+
>>> Undate.parse("--05-03", "ISO8601").format("EDTF")
154+
'XXXX-05-03'
155+
>>> Undate.parse("1800/1900")
153156
<UndateInterval 1800/1900>
154157
```
155158

0 commit comments

Comments
 (0)