Closed j3soon closed 2 years ago
Oh, I didn't think of using helper functions to extract datetime
and timedelta
from OrgDate
. Using helper functions are much more straightforward and cleaner than the iterator
solution.
To make the OrgDate
class more accessible, maybe we can add the following features in the future:
OrgDate
in __init__.py (users can import the class instead of copying the code as mentioned in #14)datetime
and timedelta
from OrgDate
. (improve the user experience of #15)
This pull request solves issue #15
Format Definition in the OrgMode manual
Description
_repeater
and a_warning
field inOrgDate
class. Both of them are a 3-element tuple(prefix, number, interval)
.OrgDate.from_str
method, sofrom_str
does not support repeaters and warnings.Unsupported format examples
These edge cases isn't supported by OrgMode, so we don't need to support them:
[Further Improvements] Use
OrgDate
as an iterator?Here are some test cases:
We may add something like this in
OrgDate
:However,
datetime.timedelta
does not supportmonths
andyears
. We may use python-dateutil for this, but it'll introduce an extra external dependency. Implement the behavior by hand is error-prone, so we may discuss how to implement this in the future.