microformats / php-mf2

php-mf2 is a pure, generic microformats-2 parser for PHP. It makes HTML as easy to consume as JSON.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fails to recognize timezone in extra value-class-pattern-element

sknebel opened this issue · comments

commented

The following snippet has date, time and timezone offset in three different elements, using the value-class-pattern.

<div class="h-event">
 <span class="e-summary">HomebrewWebsiteClub Berlin</span> will be next on 
 <span class="dt-start">
  <span class="value">2017-05-31</span>, from
  <span class="value">19:00</span> (UTC<span class="value">+02:00</span>)
</span> to  <span class="dt-end">21:00</span>.</div>

I would have expected a value of 2017-05-31 19:00+02:00 for start, per http://microformats.org/wiki/value-class-pattern#Date_and_time_parsing

[…] the parser assembles the overall datetime value by concatenating the specific date, " " (space character) and specific time (if time was specified, with 00 minutes implied if no minutes are provided), and specific timezone (if timezone and a specific time was specified)

Instead, the timezone is completely dropped: http://pin13.net/mf2/?id=20170529135806714

"properties": {
                  
                "start": ["2017-05-31T19:00"],
                

Not so much a bug as a missing feature. There is no code to handle timezones separate from the timestamp (<span class="value">19:00+02:00</span> is accepted).

See Parser.php lines 709–715 for the supported value parts.

This was fixed in #131