diff options
context:
space:
mode:
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Wrap the dates in time elements
Diffstat (limited to '')
-rw-r--r--source/ui-shared.c15
1 file changed, 12 insertions, 3 deletions
diff --git a/source/ui-shared.c b/source/ui-shared.c
index 7a2255e..1f45520 100644
--- a/source/ui-shared.c
+++ b/source/ui-shared.c
@@ -289,9 +289,16 @@ static struct date_mode configured_date_mode(void)
return mode;
}
+/*
+ * Dates render as time elements, whose datetime attribute wants the strict
+ * ISO 8601 form with the T separator rather than the space git prints by
+ * default.
+ */
static void print_abs_date(time_t t, int tz)
{
- html("<span title='");
+ html("<time datetime='");
+ html_attr(show_date(t, tz, cgit_date_mode(DATE_ISO8601_STRICT)));
+ html("' title='");
html_attr(show_date(t, tz, cgit_date_mode(DATE_ISO8601)));
html("'>");
html_txt(show_date(t, tz, configured_date_mode()));
@@ -301,9 +308,11 @@ static void print_abs_date(time_t t, int tz)
static void print_rel_date(time_t t, int tz, double count, const char *class,
const char *suffix)
{
- htmlf("<span class='%s' data-ut='%" PRIu64 "' title='", class, (uint64_t)t);
+ htmlf("<time class='%s' datetime='", class);
+ html_attr(show_date(t, tz, cgit_date_mode(DATE_ISO8601_STRICT)));
+ htmlf("' data-ut='%" PRIu64 "' title='", (uint64_t)t);
html_attr(show_date(t, tz, cgit_date_mode(DATE_ISO8601)));
- htmlf("'>%.0f %s</span>", count, suffix);
+ htmlf("'>%.0f %s</time>", count, suffix);
}
static char *http_date(time_t t)