Fix inclusive Since comparison for historical tax rates#750
Merged
samlown merged 1 commit intoinvopop:mainfrom Mar 3, 2026
Merged
Fix inclusive Since comparison for historical tax rates#750samlown merged 1 commit intoinvopop:mainfrom
samlown merged 1 commit intoinvopop:mainfrom
Conversation
8df24ff to
876ccd7
Compare
Also add missing tests
876ccd7 to
8c16a2e
Compare
samlown
approved these changes
Mar 2, 2026
Collaborator
samlown
left a comment
There was a problem hiding this comment.
Very nice catch. Clearly, we've never had a VAT rate chance since launching GOBL! Thanks!
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #750 +/- ##
=======================================
Coverage 93.05% 93.05%
=======================================
Files 333 333
Lines 17785 17785
=======================================
Hits 16549 16549
Misses 870 870
Partials 366 366 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
13 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
While adding tests for historical rates in the FI regime implemented in #748, I realized that
RateDef.Value()usedSince.Before(date)(strictly less than) to match historical rates, so an invoice issued on the exactSincedate would get the previous rate instead.Existing regimes with historical rates (DE, CO, ES) define
Sinceas the actual effective date (e.g.,Since: 2017-01-01meaning "from January 1st onwards"). The previous comparison silently shifted that by one day.Changes
!Since.After(date)to makeSincean inclusive lower bound.RateDef.Value()covering boundary, nil, and no-match casesPre-Review Checklist
go generate .to ensure that the Schemas and Regime data are up to date.And if you are part of the org: