From 853f7710ccb338ac4abf3433b9ab4270be083c46 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sat, 22 Sep 2018 16:45:00 +0200 Subject: better dates on filelist --- app/client/util/format.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'app/client/util/format.js') diff --git a/app/client/util/format.js b/app/client/util/format.js index c8e8f3f..ee1f47f 100644 --- a/app/client/util/format.js +++ b/app/client/util/format.js @@ -38,6 +38,22 @@ export function carbon_date (date, no_bold) { { color = "quiet" } return color } +export function carbon_time (date, no_bold) { + var span = (+new Date() - new Date(date)) / 1000, color + if (! no_bold && span < 3600) // modified this hour + { color = "new" } + else if (span < 3 * 3600) // modifed last 3 hours + { color = "recent" } + else if (span < 12 * 3600) // modifed last 12 hours + { color = "med" } + else if (span < 24 * 3600) // modifed last day + { color = "old" } + else if (span < 48 * 3600) // modifed last two days + { color = "older" } + else + { color = "quiet" } + return color +} export function hush_views (n, bias, no_bold) { var txt = commatize(n, 1000) bias = bias || 1 -- cgit v1.2.3-70-g09d2