Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
kohler committed Feb 24, 2025
1 parent baec720 commit 2c7a47d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/conference.php
Original file line number Diff line number Diff line change
Expand Up @@ -3214,7 +3214,7 @@ function parse_time($d, $reference = null) {
}
$d = trim($d);
if (str_ends_with($d, " ago")) {
return $this->parse_time_relative($d, $reference);
return $this->parse_time_relative(strtolower($d), $reference);
}
if (!preg_match('/\A(.*)\b(utc(?=[-+])|aoe(?=\s|\z))(.*)\z/i', $d, $m)) {
return strtotime($d, $reference);
Expand Down Expand Up @@ -3364,7 +3364,7 @@ function unparse_time_relative($timestamp, $reference = 0, $format = 0) {
private function parse_time_relative($s, $reference) {
$upos = -1;
$yr = $mo = $sec = 0;
while (preg_match('/\A\s*+(\d++\.?+\d*+|\.\d++)\s*+(y(?:|r|ear)s?|mo(?:|nth)s?|w(?:|k|eek)s?|d(?:|ay)s?|h(?:|r|our)s?|m(?:|in|inute)s?|s(?:|ec|econd)s?)(?![a-z])/i', $s, $m)) {
while (preg_match('/\A\s*+(\d++\.?+\d*+|\.\d++)\s*+(y(?:|r|ear)s?|mo(?:|n|nth)s?|w(?:|k|eek)s?|d(?:|ay)s?|h(?:|r|our)s?|m(?:|in|inute)s?|s(?:|ec|econd)s?)(?![a-z])/', $s, $m)) {
$unit = $m[2];
$s = substr($s, strlen($m[0]));
if ($unit[0] === "y") {
Expand Down

0 comments on commit 2c7a47d

Please sign in to comment.