Repository navigation
fix(nb): improve Norwegian Bokmål date parsing - #1334
Merged
Merged
Conversation
- Add plural forms for time units (måneder, uker, dager, timer, minutter, sekunder) - Add weekday abbreviations (man, tir, ons, tor, fre, lør, søn) - Add noon/midnight translations (middag, midnatt) - Add kl/kl. to skip list to support 'dato kl 14:30' format - Add simplifications for Norwegian number words (en, to, tre...) - Remove duplicate entries already present in CLDR data - Regenerate nb.py via write_complete_data.py
AdrianAtZyte
reviewed
Jun 5, 2026
AdrianAtZyte
reviewed
Jun 5, 2026
Member
|
Besides cleaning the changes, please extend tests to cover at least some of the new scenarios. And make sure to run the tests locally to verify that the changes do not (unintentionally) break pre-existing tests. |
Changes to nb.yaml: - Keep only data not already present in CLDR - Add plural time units: måneder, uker, dager, timer, minutter, sekunder - Add relative-type-regex only for 'dager siden' (missing in CLDR) - Add ago/in translations: siden, om - Add noon/midnight: middag, midnatt - Add skip tokens: kl, kl. (enables parsing of 'dato kl 14:30') - Add simplifications for Norwegian number words: en, to, tre... - Remove all entries duplicated from CLDR (weekday abbr., month abbr., regex) nb.py regenerated via dateparser_scripts/write_complete_data.py. Verified with custom duplicate checker: no duplicates in any category. Tests added to tests/test_languages.py: - 3 måneder siden -> 3 month ago - 2 dager siden -> 2 day ago - 5 uker siden -> 5 week ago - 30 minutter siden -> 30 minute ago - 45 sekunder siden -> 45 second ago - om 3 uker -> in 3 week - om 2 måneder -> in 2 month All 19 nb tests pass locally. Pre-existing tests unaffected.
Member
|
(closed and reopened so that CI would pick up 333e519, which I have just merged) |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1334 +/- ##
=======================================
Coverage 97.11% 97.11%
=======================================
Files 235 235
Lines 2912 2912
=======================================
Hits 2828 2828
Misses 84 84 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
AdrianAtZyte
reviewed
Jun 5, 2026
Remove 'noon' (middag) and 'midnight' (midnatt) from nb.yaml as these are not supported by the current dateparser infrastructure without additional code changes. A separate PR can be created if/ when code support for noon/midnight translations is added.
Member
|
Thanks! |
Merged
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.
Summary
Improves Norwegian Bokmål (nb) date parsing support by updating
supplementary language data and regenerating nb.py.
Changes
Test results
All 20 test cases pass:
Notes
tox could not be run locally — atheris does not support Windows.
CI will run the full test suite on Linux.