Skip to content

feat(date): add Format::parse() and Format::parseDateTime()#14

Merged
TDannhauer merged 1 commit into
FRAMEWORK_6_0from
feat/format-parse
May 22, 2026
Merged

feat(date): add Format::parse() and Format::parseDateTime()#14
TDannhauer merged 1 commit into
FRAMEWORK_6_0from
feat/format-parse

Conversation

@ralflang

@ralflang ralflang commented May 22, 2026

Copy link
Copy Markdown
Member

Generalizes the solution needed for horde/nag#21

From a formatted date string and a format string, detect the formatter and create a Horde\Date\Date object.
Optionally use the Horde\Date\Date to create a Horde_Date or (type compatible) Horde\Date\HordeLegacyDate

$date = Format::parse($formattedDate, $formatString);
$legacyHordeDate = new Horde\Date\HordeLegacyDate($date);

Static entry points that detect pattern type (strftime/ICU/PHP date)
and dispatch to the appropriate formatter's parse method. parseDateTime
combines separate date and time patterns atomically, fixing AM/PM regex
splitting bugs in consumers.

@TDannhauer TDannhauer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parseDateTime() : ⚠ Fix or document PHP pattern gap

isPhpDateFormat() : ⚠ Document limitations; consider visibility

@TDannhauer TDannhauer merged commit f869f5a into FRAMEWORK_6_0 May 22, 2026
0 of 8 checks passed
@TDannhauer TDannhauer mentioned this pull request May 22, 2026
ralflang added a commit that referenced this pull request May 22, 2026
Release version 3.0.0-RC3

chore:gitignore
refactor: Port to modern NLS implementation
fix(format): remove PHP date() auto-detection from Format::parse()
Update FormatParseTest.php
Enhance isPhpDateFormat to exclude ICU shortcuts
Merge pull request #14 from horde/feat/format-parse
feat(date): add Format::parse() and Format::parseDateTime()
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.

2 participants