-
Notifications
You must be signed in to change notification settings - Fork 175
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
Make applyDuration
reversible
#298
Conversation
0eda15b
to
d37caed
Compare
It looks as though there's a test failure - that perhaps should be changed with this change? |
The failing test is not because of or affected by this change as stated in my original comment (it also appears that quite a few tests use In the test of the check you run:
it is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking nice!
@github/primer-reviewers you should merge this one and make a patch release with this.
…#6559) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@github/relative-time-element](https://github.com/github/relative-time-element) | dependencies | patch | [`4.4.4` -> `4.4.5`](https://renovatebot.com/diffs/npm/@github%2frelative-time-element/4.4.4/4.4.5) | --- ### Release Notes <details> <summary>github/relative-time-element (@​github/relative-time-element)</summary> ### [`v4.4.5`](https://github.com/github/relative-time-element/releases/tag/v4.4.5) [Compare Source](github/relative-time-element@v4.4.4...v4.4.5) #### What's Changed - fix: wrap Intl.<>() calls in try/catch by [@​francinelucca](https://github.com/francinelucca) in github/relative-time-element#297 - get main branch green by [@​keithamus](https://github.com/keithamus) in github/relative-time-element#302 - Make `applyDuration` reversible by [@​leduyquang753](https://github.com/leduyquang753) in github/relative-time-element#298 - Use node v22 by [@​camertron](https://github.com/camertron) in github/relative-time-element#303 #### New Contributors - [@​francinelucca](https://github.com/francinelucca) made their first contribution in github/relative-time-element#297 - [@​leduyquang753](https://github.com/leduyquang753) made their first contribution in github/relative-time-element#298 - [@​camertron](https://github.com/camertron) made their first contribution in github/relative-time-element#303 **Full Changelog**: github/relative-time-element@v4.4.4...v4.4.5 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "* 0-3 * * *" (UTC), Automerge - "* 0-3 * * *" (UTC). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xMDYuMCIsInVwZGF0ZWRJblZlciI6IjM5LjEwNi4wIiwidGFyZ2V0QnJhbmNoIjoiZm9yZ2VqbyIsImxhYmVscyI6WyJkZXBlbmRlbmN5LXVwZ3JhZGUiLCJ0ZXN0L25vdC1uZWVkZWQiXX0=--> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6559 Reviewed-by: Otto <[email protected]> Co-authored-by: Renovate Bot <[email protected]> Co-committed-by: Renovate Bot <[email protected]>
(This is part of a set of multiple pull requests looking to overhaul the calculation functions.)
When the duration to be applied is negative, this pull request makes the application order of the components reversed compared to when the duration is positive, so that adding a duration to a date then subtracting the same amount yields the same date.
Note: One test is failing on my end from the current upstream code:
This is caused by the current implementation of
roundToNearestUnit
computing the future date to be in 2027, resulting in a 3-year difference as it only considers the year alone in this case. This will be fixed with a reimplementation of the function in one of my other pull requests.