Skip to content

Commit 9cdf579

Browse files
committed
fix for #153
adds check for Z when checking whether to use the implied timezone closes #153
1 parent bbd6569 commit 9cdf579

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Mf2/Parser.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,7 @@ public function parseDT(\DOMElement $dt, &$dates = array(), &$impliedTimezone =
856856

857857
$dtValue = unicodeTrim($dtValue);
858858

859+
// Store the date part so that we can use it when assembling the final timestamp if the next one is missing a date part
859860
if (preg_match('/(\d{4}-\d{2}-\d{2})/', $dtValue, $matches)) {
860861
$dates[] = $matches[0];
861862
}
@@ -1032,7 +1033,7 @@ public function parseH(\DOMElement $e, $is_backcompat = false, $has_nested_mf =
10321033
foreach ($temp_dates as $propName => $data) {
10331034
foreach ( $data as $dtValue ) {
10341035
// var_dump(preg_match('/[+-]\d{2}(\d{2})?$/i', $dtValue));
1035-
if ( $impliedTimezone && preg_match('/[+-]\d{2}:?(\d{2})?$/i', $dtValue, $matches) == 0 ) {
1036+
if ( $impliedTimezone && preg_match('/(Z|[+-]\d{2}:?(\d{2})?)$/i', $dtValue, $matches) == 0 ) {
10361037
$dtValue .= $impliedTimezone;
10371038
}
10381039

0 commit comments

Comments
 (0)