Closed yassersouri closed 11 years ago
It's not supported in python standard datetime module so it's better not to be implemented here!
But you can always do this:
>>> datetime.datetime.now().date() == datetime.date.today()
True
I think there is a misunderstanding:
I mean this:
>>> dt = datetime.datetime.now()
>>> jdt = jdatetime.datetime.now()
>>> dt > jdt
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "jdatetime/__init__.py", line 837, in __lt__
raise TypeError("unsupported operand type for <: '%s'"%(type(other_datetime)))
I think all operands are implemented in such a way that they raise this exception.
What do say about this :
>>> dt = datetime.datetime.now()
>>> jdt = jdatetime.datetime.now()
>>> dt > jdt.togregorian()
False
I know the thing that you want is just a few lines change but it ruins the integrity of this lib with python datetime module. Also consider if someone wants to use it this way :
jdatetime.datetime.now() > datetime.datetime.now()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build/bdist.macosx-10.8-intel/egg/jdatetime/__init__.py", line 784, in __gt__
TypeError: unsupported operand type for >: '<type 'datetime.datetime'>'
Then there would be no way to change the python's datetime.
salam
https://github.com/slashmili/python-jalali/blob/master/jdatetime/__init__.py#L820
we really need to compare between
datetime
s andjdatetime
s, what can we do?