Skip to content

Conversation

@khaledalam
Copy link

Description

Fixes #21027

strtotime("2.37685 weeks") returned incorrect result (~414 million seconds instead of ~1.4 million) because:

  • "2.37" matched timeshort24 pattern (hour:minute with dot separator)
  • "685 weeks" was parsed as separate relative offset

Changes

  • Added relnumberdec regex pattern for decimal numbers
  • Added relativedec lexer rule to match decimal relative expressions
  • Added timelib_get_decimal_nr() helper to parse decimal values
  • Added timelib_set_relative_decimal() to convert decimal units to seconds

@khaledalam khaledalam force-pushed the fix/gh-21027-strtotime-decimal-relative branch from e5cd267 to 03831de Compare January 25, 2026 12:41
@devnexen
Copy link
Member

You need to open a PR in the original repository instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

strtotime() has strange interpretation of decimal weeks

2 participants