Add human readable date, keep machine readable

This commit is contained in:
Chris Josten 2020-06-28 00:43:15 +02:00
parent 9f879be71b
commit 76b3ca0d33
2 changed files with 3 additions and 3 deletions

View file

@ -6,7 +6,7 @@ import std.datetime;
import dyaml; import dyaml;
string toHumanString(DateTime value) { string toHumanString(DateTime value) {
return to!string(value.year) ~ "-" ~ to!string(ubyte(value.month)) ~ "-" ~ to!string(value.day); return to!string(value.day) ~ "-" ~ to!string(ubyte(value.month)) ~ "-" ~ to!string(value.year);
} }
T getOr(T)(Node node, string key, T or) { T getOr(T)(Node node, string key, T or) {

View file

@ -19,7 +19,7 @@ block content
h1.title(itemprop="headline") #{content.title} h1.title(itemprop="headline") #{content.title}
p.subtitle p.subtitle
| By <span itemprop="author">#{content.author}</span> | By <span itemprop="author">#{content.author}</span>
| on <span itemprop="datePublished">#{content.firstPublished.toHumanString}</span> | on <time datetime="#{content.firstPublished.toISOExtString}" itemprop="datePublished">#{content.firstPublished.toHumanString}</time>
- if (content.isModified) - if (content.isModified)
|, updated on <span itemprop="dateModified">#{content.updated.toHumanString}</span> |, updated on <time datetime="#{content.updated.toISOExtString}" itemprop="dateModified">#{content.updated.toHumanString}</time>
section(itemprop="articleBody") !{content.content} section(itemprop="articleBody") !{content.content}