|
4 | 4 |
|
5 | 5 | **undate** is a python library for working with uncertain or partially known dates. |
6 | 6 |
|
7 | | -It was initially created as part of a [DH-Tech](https://dh-tech.github.io/) hackathon in November 2022. |
8 | | - |
9 | 7 | > [!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.* |
11 | 13 |
|
12 | 14 | --- |
13 | 15 |
|
|
84 | 86 | False |
85 | 87 | ``` |
86 | 88 |
|
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. |
88 | 90 |
|
89 | 91 | ```python |
90 | 92 | >>> november7_2020 = Undate(2020, 11, 7) |
@@ -137,19 +139,20 @@ An `UndateInterval` is a date range between two `Undate` objects. Intervals can |
137 | 139 | 31 |
138 | 140 | ``` |
139 | 141 |
|
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 | + |
141 | 145 | ```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") |
145 | 148 | <Undate 2002> |
146 | | ->>> isoformatter.parse("2002-05") |
| 149 | +>>> Undate.parse("2002-05", "EDTF") |
147 | 150 | <Undate 2002-05> |
148 | | ->>> isoformatter.parse("--05-03") |
149 | | -<Undate --05-03> |
150 | | ->>> isoformatter.parse("--05-03") |
| 151 | +>>> Undate.parse("--05-03", "ISO8601") |
151 | 152 | <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") |
153 | 156 | <UndateInterval 1800/1900> |
154 | 157 | ``` |
155 | 158 |
|
|
0 commit comments