Skip to content

fix(js/ts): date arithmetic: PM parsing, AddMonths day clamp, AddYears offset#4744

Open
Thorium wants to merge 1 commit into
fable-compiler:mainfrom
Thorium:fix-date-arithmetic
Open

fix(js/ts): date arithmetic: PM parsing, AddMonths day clamp, AddYears offset#4744
Thorium wants to merge 1 commit into
fable-compiler:mainfrom
Thorium:fix-date-arithmetic

Conversation

@Thorium

@Thorium Thorium commented Jul 8, 2026

Copy link
Copy Markdown
Contributor
  • The fallback parser added the PM designator as 720 seconds (12 minutes instead of 12 hours), so Parse("3:30 PM") gave 3:42; also added the missing 12 AM -> 00 handling
  • AddMonths landed one day early whenever month+delta was a positive multiple of 12 (newMonth % 12 = 0 made daysInMonth clamp day 31 to 30); normalization rewritten in canonical modular form in both Date and DateOffset
  • DateTimeOffset.AddYears read raw UTC fields instead of offset-adjusted ones, shifting the wall clock by the offset

(split from #4738)

- The fallback parser added the PM designator as 720 seconds
  (12 minutes instead of 12 hours), so Parse("3:30 PM") gave 3:42;
  also added the missing 12 AM -> 00 handling
- AddMonths landed one day early whenever month+delta was a positive
  multiple of 12 (newMonth % 12 = 0 made daysInMonth clamp day 31
  to 30); normalization rewritten in canonical modular form in both
  Date and DateOffset
- DateTimeOffset.AddYears read raw UTC fields instead of
  offset-adjusted ones, shifting the wall clock by the offset
@Thorium Thorium changed the title fix: date arithmetic: PM parsing, AddMonths day clamp, AddYears offset fix(js/ts): date arithmetic: PM parsing, AddMonths day clamp, AddYears offset Jul 9, 2026
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