-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix compare datetime with diffrent timezones #159
base: main
Are you sure you want to change the base?
Fix compare datetime with diffrent timezones #159
Conversation
I added another commit to fix a test failure on AppVeyor. On Windows, you just need to install |
Thanks @mobinghoveoud! I'm wondering if it's easier to convert the data to python's datetime and let python module compare the dates! |
Thanks for reply @slashmili . If performance is a priority, the current method works well but if easier implementation and maintenance are more important, the conversion approach could be a feasible alternative. I agree with both approaches. |
Thanks @slashmili for asking my opinion here. The change LGTM 👍 I agree with @mobinghoveoud that the current implementation has better performance, but the data-time approach needs less maintenance effort in the future. It's up to you, @slashmili, to decide. |
Sorry for @mobinghoveoud for getting to you late. I'd prefer to not keep the logic and rely on python datetime. I'd say speed of comparison has lower priority compare to maintainability of this project. |
Thanks, I'll try this approach. |
…thon datetime + Update methods + Update tests
To compare the datetimes, first converted to python datetime objects.
|
fix #158
Description of Changes
This PR enhances the comparison operations in the
datetime
class, similar to the Python datetime module, to resolve issues with time comparisons involving different timezones.Testing
To ensure the accuracy of the changes, I added several tests to the project. Since the main comparison logic is handled in the
_cmp
method, primary tests were written for this function. Additionally, I added tests for methods like__eq__
,__gt__
, etc., by mocking the_cmp
method as needed.If there are any issues or areas for improvement, please feel free to let me know.
Thanks.