Repository navigation
Conversation
Fold a fortnight into 2 weeks and a century into 100 years, like decades.
Also keep the "in" of future expressions ("a decade from now") when the
unit is a decade, fortnight or century.
Refs scrapinghub#725
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Codecov Reportβ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1539 +/- ##
=======================================
Coverage 98.96% 98.97%
=======================================
Files 239 239
Lines 3592 3594 +2
=======================================
+ Hits 3555 3557 +2
Misses 37 37 β View full report in Codecov by Harness. π New features to boost your workflow:
|
The "later" simplification only allowed "century" plus an optional "s", so "2 centuries later" was not recognised. Refs scrapinghub#725 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The ordinal suffix is a skip word, so "20th century" was translated to "20 century" and parsed as 20 centuries ago (and "in the 20th century" in search_dates as 20 centuries ahead). Refs scrapinghub#725 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
AdrianAtZyte
approved these changes
Oct 9, 2026
serhii73
approved these changes
Oct 20, 2026
serhii73
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed the diff and ran the full suite on this branch merged with current master (24809 passed); CI is green. The century and fortnight handling folds into years and weeks consistently, and the ordinal guard (20th century) is covered by tests.
This was referenced Oct 20, 2026
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.
Resolves #725.
"decade" was already supported; this adds the other two words from the issue, for English only.
New words
fortnight,fortnightscentury,centuriesCLDR has no data for these words (it has no decade, century or fortnight field), so they are added to the supplementary English YAML and
en.pyis regenerated from it.Supported phrases
2 fortnights,a fortnight2 centuries,a century2 fortnights ago,a fortnight ago2 centuries ago,a century agoin a fortnight,in 2 fortnightsin a century,in two centurieslast fortnight,this fortnight,next fortnightlast century,this century,next centurya fortnight later,two fortnights latera century later,2 centuries latera fortnight from now2 centuries from now1 fortnight 3 days ago1 century 2 decades agoThese also work with number words (
two), decimals (1.5 centuries ago), signs (+1 century) and a trailing time (in a fortnight at 5pm).Other changes
from now/infor decades:a decade from nowandin 1 decaderesolved to the past, because theinwas dropped. Decade, fortnight and century are now in the unit list ofLocale._clear_future_words, so these resolve to the future.20th century,the 21st century,1st centuryand2nd fortnightreturn None. Without the guard the ordinal suffix is a skip word, so20th centurywas read as 20 centuries ago (andsearch_datesread "in the 20th century" as year 4026).Not covered
Bare
fortnight ago(no number) andin a fortnight's time, which also fail forweekanddecade.half a century ago.this centuryandthis fortnightresolve to the past, matching the existingthis decade.Ordinals before the older units (
3rd decade,3rd week) are still read as relative dates, as before.Languages other than English.
I have read the contributing guide and set up pre-commit.
π€ Generated with Claude Code