[pve-devel] [PATCH manager v2 1/2] Add a new renderer for displaying dates in a human readable way

Emmanuel Kasper e.kasper at proxmox.com
Tue Jan 31 16:48:49 CET 2017


render_timestamp returns a Date as
"2017-01-31 16:17:33"
which is good for computers and column sorting but unfit
for human consumption

the new renderer added by this patch renders a Date as
"Tuesday 31 January 2017 16:18:08"

Day-month-year order is the most used ordering
in the world and also commonly used in the USA for
official documents.
source:
https://en.wikipedia.org/wiki/Date_and_time_notation_in_the_United_States
https://en.wikipedia.org/wiki/Date_format_by_country
---
 www/manager6/Utils.js | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index c05a137..148a122 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -913,6 +913,10 @@ Ext.define('PVE.Utils', { utilities: {
 	return Ext.Date.format(servertime, 'Y-m-d H:i:s');
     },
 
+    render_timestamp_human_readable: function(value) {
+	return Ext.Date.format(new Date(value * 1000), 'l d F Y H:i:s');
+    },
+
     calculate_mem_usage: function(data) {
 	if (!Ext.isNumeric(data.mem) ||
 	    data.maxmem === 0 ||
-- 
2.1.4





More information about the pve-devel mailing list