slashmili / python-jalali

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

Move datetime-specific code from date methods into datetime class #154

Closed 5j9 closed 6 months ago

5j9 commented 6 months ago

Simplifies the logic and improves readability by moving datetime-specific code branches to datetime class. Also resolves some code linter warnings about attributes not being defined on date class.

_strftime_p: only raises Exception (AttributeError) on date objects because dates do not have hour attribute.

_strftime_z: only raises AttributeError on a date class becuase date does not have utcoffset attribute.

_strftime_cap_z: date does not have tzname attribute, but datetime has.

hramezani commented 6 months ago

@5j9 please rebase on top of main

hramezani commented 6 months ago

Thanks @5j9

slashmili commented 6 months ago

Nice work @5j9 👍🏼