]> gitweb.ps.run Git - ps-cgit/blobdiff - ui-shared.c
ui-shared: add cgit_date_mode()
[ps-cgit] / ui-shared.c
index 54bbde757951df30824484969276578f8c0a8650..923d1025f71f062832a8a7df22b24d2107fa8ad1 100644 (file)
@@ -627,6 +627,15 @@ void cgit_print_date(time_t secs, const char *format, int local_time)
        html_txt(fmt_date(secs, format, local_time));
 }
 
+const struct date_mode *cgit_date_mode(const char *format)
+{
+       static struct date_mode mode;
+       mode.type = DATE_STRFTIME;
+       mode.strftime_fmt = format;
+       mode.local = ctx.cfg.local_time;
+       return &mode;
+}
+
 static void print_rel_date(time_t t, double value,
        const char *class, const char *suffix)
 {
@@ -635,7 +644,7 @@ static void print_rel_date(time_t t, double value,
        htmlf("'>%.0f %s</span>", value, suffix);
 }
 
-void cgit_print_age(time_t t, time_t max_relative, const char *format)
+void cgit_print_age(time_t t, time_t max_relative)
 {
        time_t now, secs;
 
@@ -650,7 +659,7 @@ void cgit_print_age(time_t t, time_t max_relative, const char *format)
                html("<span title='");
                html_attr(fmt_date(t, FMT_LONGDATE, ctx.cfg.local_time));
                html("'>");
-               cgit_print_date(t, format, ctx.cfg.local_time);
+               cgit_print_date(t, FMT_SHORTDATE, ctx.cfg.local_time);
                html("</span>");
                return;
        }