Skip to content
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

easier way to subtract a duration from a time #85

Merged
merged 1 commit into from
Jan 19, 2023

Conversation

mreinsch
Copy link
Contributor

previous behaviour resulted in same as addition:

Fugit.parse('1Y') + Time.parse("2023-01-19T12:07:00T")
# => 2024-01-19T12:07:00T

Fugit.parse('1Y') - Time.parse("2023-01-19T12:07:00T")
# => 2024-01-19T12:07:00T

With this change, the duration is now subtracted from the time:

Fugit.parse('1Y') + Time.parse("2023-01-19T12:07:00T")
# => 2024-01-19T12:07:00T

Fugit.parse('1Y') - Time.parse("2023-01-19T12:07:00T")
# => 2022-01-19T12:07:00T

Mathematically this isn't quite correct I suppose, but neither is the current behaviour.

previous behaviour resulted in same as addition:

```ruby
Fugit.parse('1Y') + Time.parse("2023-01-19T12:07:00T")
# => 2024-01-19T12:07:00T

Fugit.parse('1Y') - Time.parse("2023-01-19T12:07:00T")
# => 2024-01-19T12:07:00T
```

With this change, the duration is now subtracted from the time:

```ruby
Fugit.parse('1Y') + Time.parse("2023-01-19T12:07:00T")
# => 2024-01-19T12:07:00T

Fugit.parse('1Y') - Time.parse("2023-01-19T12:07:00T")
# => 2022-01-19T12:07:00T
```

Mathematically this isn't quite correct I suppose, but neither is the current behaviour.
@jmettraux jmettraux self-assigned this Jan 19, 2023
@jmettraux jmettraux merged commit 0027200 into floraison:master Jan 19, 2023
@jmettraux
Copy link
Member

ありがとうございます!

@jmettraux
Copy link
Member

@mreinsch thanks again. hisashiburija! Are you OK if I release fugit 1.8.1 with your fixes tomorrow morning GMT+9?

@mreinsch
Copy link
Contributor Author

@jmettraux it's been quite a while indeed! And first time I manage to contribute back to one of your projects :-)
Thanks very much for the quick merge. No need to hurry on the release, I'll use master for now.

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.

2 participants