Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented Jul 21, 2018

The closest/farthest functions didn't actually consider the distance between the current instance and the two parameters. On master, the 'smaller'/'bigger' was returned regardless of the actual distance between the instance and the parameters.

>>> a = pendulum.now()
>>> b = pendulum.now() + pendulum.duration(hours=10)
>>> c = pendulum.now() + pendulum.duration(hours=-15)
>>> a.closest(b,c) == c
True
>>> # however, the closest is actually b
>>> # similarly, using farthest, should return C but instead returns b :
>>> a.farthest(b,c) == b
True

In addition, I have extended the functionality to receive unpacked iterables, through * operator while keeping the initial signature and backwards compatibility.

For some reason this Travis build failed but mine worked.

https://travis-ci.org/oddProton/pendulum/builds/406625985

@ghost
Copy link
Author

ghost commented Jul 24, 2018

Can you check it out and tell me what you’d like for the pull to go through?

@sdispater sdispater merged commit 41753d1 into python-pendulum:master Jul 30, 2018
@sdispater
Copy link
Collaborator

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant