From 3e604360f89faebb67a7c951d9ce14355f2c47e8 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Tue, 5 Apr 2011 08:35:48 +0200 Subject: [PATCH] added "time ago" as {0} to formatTimestamp --- scm-webapp/src/main/webapp/resources/js/sonia.util.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scm-webapp/src/main/webapp/resources/js/sonia.util.js b/scm-webapp/src/main/webapp/resources/js/sonia.util.js index 7c553cae95..1915436b49 100644 --- a/scm-webapp/src/main/webapp/resources/js/sonia.util.js +++ b/scm-webapp/src/main/webapp/resources/js/sonia.util.js @@ -32,14 +32,21 @@ Ext.apply(Ext.util.Format, { formatTimestamp: function(value){ + var date = null; var result = ''; if ( value != null && (value > 0 || value.length > 0)){ var df = state.clientConfig.dateFormat; if ( df == null || df.length == 0 || ! Ext.isDefined(value) ){ df = "Y-m-d H:i:s"; } - result = Ext.util.Format.date(new Date(value), df); + date = new Date(value); + result = Ext.util.Format.date(date, df); } + + if (date != null && result.indexOf("{0}") >= 0){ + result = String.format( result, Ext.util.Format.timeAgo(date) ); + } + return result; },