slashmili / python-jalali

Jalali calendar binding for Python based on Python's datetime module
http://pypi.python.org/pypi/jdatetime/
Other
335 stars 46 forks source link

implement `fromisoformat` method for datetime class #134

Closed 5j9 closed 1 year ago

5j9 commented 1 year ago

fromisoformat was added in Python 3.7 for date, datetime, and time classes. jdatettime already supports it for time (which inherits from the built-in pyhton class) and recently implemented it for date, but still needs to implement it for datetime class.

Also note that in Python 3.11 fromisoformat is more forgiving on the format of the input strings, for example date.fromisoformat now accepts YYYYMMDD format:

from datetime import date

date.fromisoformat('2019-12-04')
datetime.date(2019, 12, 4)

date.fromisoformat('20191204')
datetime.date(2019, 12, 4)

date.fromisoformat('2021-W01-1')
datetime.date(2021, 1, 4)

Changed in version 3.11: Previously, this method only supported the format YYYY-MM-DD.