From 07681364f851c78d7c9b94e51f0f744f3901fd05 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Thu, 12 Nov 2015 15:46:56 +0000 Subject: [PATCH] Add new type for date widget to show only time(in today range)/date --- etemplate/js/et2_widget_date.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/etemplate/js/et2_widget_date.js b/etemplate/js/et2_widget_date.js index fd651e9d66..e8b1f03aad 100644 --- a/etemplate/js/et2_widget_date.js +++ b/etemplate/js/et2_widget_date.js @@ -971,12 +971,17 @@ var et2_date_ro = et2_valueWidget.extend([et2_IDetachedDOM], var display = this.date.toString(); switch(this._type) { + case "time_or_date": case "date-time_today": // Today - just the time if(date('Y-m-d', this.date) == date('Y-m-d')) { display = date(this.egw().preference('timeformat') == '24' ? 'H:i' : 'g:i a', this.date); } + else if (this._type === "time_or_date") + { + display = date(this.egw().preference('dateformat'), this.date); + } // Before today - date and time else { @@ -1087,7 +1092,7 @@ var et2_date_ro = et2_valueWidget.extend([et2_IDetachedDOM], } } }); -et2_register_widget(et2_date_ro, ["date_ro", "date-time_ro", "date-since", "date-time_today"]); +et2_register_widget(et2_date_ro, ["date_ro", "date-time_ro", "date-since", "date-time_today", "time_or_date"]); /** * @augments et2_date_ro