Skip to content

Default partial date parsing to year 1970 - #15

Draft
viacheslav-augment wants to merge 2 commits into
0.90from
viacheslav-augment/partial-date-default-year-1970
Draft

Default partial date parsing to year 1970#15
viacheslav-augment wants to merge 2 commits into
0.90from
viacheslav-augment/partial-date-default-year-1970

Conversation

@viacheslav-augment

Copy link
Copy Markdown

Problem
When a date format omits the year, Joda defaults the missing year to 2000, so partial dates (e.g. a time-only or month/day value) parse into the wrong year.

Solution
Set the parsers built in Joda.forPattern to withDefaultYear(1970) so partial dates use the epoch base — consistent with the 1970-01-01 base already used for round-ceil parsing in DateMathParser and with how partial dates are indexed. Full dates are unaffected.

Testing
Added a DateMathParserTests case asserting a year-less MM-dd pattern parses 01-01 → epoch 0 and 06-151970-06-15.


Pull Request opened by Augment Code | View session

When a date format omits the year, Joda defaults the missing year to 2000.
Set the parsers' default year to 1970 so partial dates use the epoch base,
consistent with the 1970-01-01 base already used for round-ceil parsing in
DateMathParser and with how partial dates are indexed.
Covers Joda.forPattern parsers defaulting the missing year to the 1970
epoch base rather than joda's default of 2000.
@viacheslav-augment viacheslav-augment self-assigned this Aug 4, 2026
@viacheslav-augment

Copy link
Copy Markdown
Author

PR Author Agent

👋 I've got this PR.

I'll handle review feedback, CI failures, and merge conflicts, and ping you the moment it's ready for review. Drop a comment anytime.

Marking it ready and picking reviewers are your call — I'll leave both alone.

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.

1 participant