page: move showdate() into formatting include
[minimedit.git] / format.inc.php
diff --git a/format.inc.php b/format.inc.php
new file mode 100644 (file)
index 0000000..10908f3
--- /dev/null
@@ -0,0 +1,16 @@
+<?php
+global $monthname;
+$monthname = ['?',
+       'januari', 'februari', 'maart', 'april', 'mei', 'juni',
+       'juli', 'augustus', 'september', 'oktober', 'november', 'december',
+];
+
+function showdate($parts)
+{
+       global $monthname;
+       return implode(' ', array_filter([
+               intval(@$parts[2]), $parts[1] > 0 ? $monthname[intval($parts[1])] : '', $parts[0],
+               count($parts) > 5 ? "$parts[3]:$parts[4]" : '',
+       ]));
+}
+