From 57abd48625099dfdad7264ee11cdc3073b777864 Mon Sep 17 00:00:00 2001 From: nathangray Date: Tue, 21 Nov 2017 10:26:54 -0700 Subject: [PATCH] Etemplate - add 'format' option to timestamper to specify the time format --- api/js/etemplate/et2_widget_timestamper.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/api/js/etemplate/et2_widget_timestamper.js b/api/js/etemplate/et2_widget_timestamper.js index 0c3d3a3f56..9a211f8513 100644 --- a/api/js/etemplate/et2_widget_timestamper.js +++ b/api/js/etemplate/et2_widget_timestamper.js @@ -30,6 +30,12 @@ var et2_timestamper = (function(){ "use strict"; return et2_button.extend([], default: et2_no_init, description: "Which field to place the timestamp in" }, + format: { + name: "Time format", + type: "string", + default: et2_no_init, + description: "Format for the timestamp. User is always after." + }, image: { default: "timestamp" }, @@ -65,7 +71,11 @@ var et2_timestamper = (function(){ "use strict"; return et2_button.extend([], _insert_text: function() { var text = ""; var now = new Date(); - text += date(egw.preference('dateformat') + ' ' + (egw.preference("timeformat") === "12" ? "h:ia" : "H:i")+' ',now); + var format = (this.options.format ? + this.options.format : + egw.preference('dateformat') + ' ' + (egw.preference("timeformat") === "12" ? "h:ia" : "H:i"))+' '; + + text += date(format, now); // Get properly formatted user name var user = parseInt(egw.user('account_id'));