From a16bdccbbe790345394303fe53c2df4fae2bf8d8 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Tue, 25 Jun 2019 20:24:22 +0200 Subject: [PATCH] nieuws/feed: conform article dates to RFC-3339 Omit duplicate date match (from dateparts) and append time part as required by specs and Atom syntax. --- nieuws.inc.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/nieuws.inc.php b/nieuws.inc.php index 40432a9..34b565a 100644 --- a/nieuws.inc.php +++ b/nieuws.inc.php @@ -9,8 +9,8 @@ function showdate($parts) { global $monthname; return implode(' ', array_filter([ - intval(@$parts[3]), $parts[2] > 0 ? $monthname[intval($parts[2])] : '', $parts[1], - count($parts) > 6 ? "$parts[4]:$parts[5]" : '', + intval(@$parts[2]), $parts[1] > 0 ? $monthname[intval($parts[1])] : '', $parts[0], + count($parts) > 5 ? "$parts[3]:$parts[4]" : '', ])); } @@ -61,12 +61,13 @@ class ArchiveArticle function dateparts() { preg_match('< / (\d{4}) [/-] (\d{2}) (?:- (\d{2}) )? - >x', $this->page, $ymd); + array_shift($ymd); return $ymd; } function dateiso() { - return implode('-', $this->dateparts()); + return implode('-', $this->dateparts()) . 'T12:00:00+02:00'; } function date() @@ -157,7 +158,7 @@ function printtoc($input, $class = FALSE) $html = $article->safetitle; $dateparts = $article->dateparts; if ($class) { - $dateparts[1] = NULL; # omit year + $dateparts[0] = NULL; # omit year } $html .= sprintf(' %s', showdate($dateparts)); if ($class == 'gallery' and $article->img) { -- 2.30.0