From 37ac6b81287b5e7a5a12f7da8fdb270fc4ceda57 Mon Sep 17 00:00:00 2001 From: Adrian Cochrane Date: Fri, 16 Mar 2018 18:33:58 +1300 Subject: [PATCH] Correct and nicely format the date ranges for pages. An endash is appropriate typographically for ranges. The subquery ensures the LIMIT/OFFSET is respected in the min/max. And now I'm using the system time format. --- data/pages/history | 7 ++++--- src/Services/Prosody/lib.vala | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/data/pages/history b/data/pages/history index 29a8533..5ad8f45 100644 --- a/data/pages/history +++ b/data/pages/history @@ -36,10 +36,11 @@ and to visually communicate the paths surfers took through this history. #} {% each-row %} {% for i in num_pages %} {% if i != url.query.page %} {% empty %} diff --git a/src/Services/Prosody/lib.vala b/src/Services/Prosody/lib.vala index 4f88e32..237f5c8 100644 --- a/src/Services/Prosody/lib.vala +++ b/src/Services/Prosody/lib.vala @@ -676,7 +676,10 @@ namespace Odysseus.Templating.Std { private class DateFilter : Filter { public override Data.Data filter(Data.Data date, Data.Data format) { var datetime = new DateTime.from_unix_local(date.to_int()); - var ret = datetime.format(format.to_string()); + var format_str = format.to_string(); + if (format_str == "") + format_str = @"$(Granite.DateTime.get_default_date_format()) $(Granite.DateTime.get_default_time_format())"; + var ret = datetime.format(format_str); return new Data.Literal(ret); } }