diff --git a/themed/commit.html b/themed/commit.html
index 9f5ec47..b7f9f59 100644
--- a/themed/commit.html
+++ b/themed/commit.html
@@ -36,7 +36,7 @@
diff --git a/themed/refs.html b/themed/refs.html
index 80b4e52..18d7d2d 100644
--- a/themed/refs.html
+++ b/themed/refs.html
@@ -35,7 +35,7 @@
{% if ref->object->type == OBJ_COMMIT %}
- {{ info->subject }} · Updated {! cgit_print_age(info->committer_date, info->committer_tz, -1); !} ago
+ {{ info->subject }} · Updated {! cgit_print_age_themed(info->committer_date, info->committer_tz, TM_MONTH * 12); !}
; !}?s=24)
{{ info->author }}
@@ -86,7 +86,7 @@
{% if info && (info->tagger_date > 0 || info->tagger) %}
{% if info->tagger_date > 0 %}
- Updated {! cgit_print_age(info->tagger_date, info->tagger_tz, -1); !} ago
+ Updated {! cgit_print_age_themed(info->tagger_date, info->tagger_tz, TM_MONTH * 12); !}
{% endif %}
{% if info->tagger %}
; !}?s=24)
@@ -95,7 +95,7 @@
{% elif ref->object->type == OBJ_COMMIT %}
- Updated {! cgit_print_age(ref->commit->commit->date, 0, -1); !} ago
+ Updated {! cgit_print_age_themed(ref->commit->commit->date, 0, TM_MONTH * 12); !}
; !}?s=24)
{{ ref->commit->author }}
diff --git a/themed/summary.html b/themed/summary.html
index bcf855c..be88b54 100644
--- a/themed/summary.html
+++ b/themed/summary.html
@@ -39,7 +39,7 @@
{! short_commit_id(oid_to_hex(&commit->object.oid)); !}
·
- {! cgit_print_age(info->committer_date, info->committer_tz, TM_WEEK * 2); !} ago
+ {! cgit_print_age_themed(info->committer_date, info->committer_tz, TM_MONTH * 12); !}
{! cgit_free_commitinfo(info); !}
diff --git a/ui-shared.c b/ui-shared.c
index 92d399f..d28d903 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -784,6 +784,49 @@ void cgit_print_age(time_t t, int tz, time_t max_relative)
print_rel_date(t, tz, secs * 1.0 / TM_YEAR, "age-years", "years");
}
+void cgit_print_age_themed(time_t t, int tz, time_t max_relative)
+{
+ time_t now, secs;
+
+ if (!t)
+ return;
+ time(&now);
+ secs = now - t;
+ if (secs < 0)
+ secs = 0;
+
+ if (secs > max_relative && max_relative >= 0) {
+ html("