From: E.Smith <31170571+azlm8t@users.noreply.github.com> Date: Wed, 19 Sep 2018 18:43:05 +0000 (+0100) Subject: ui: Add grouping format specifier for dates. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3cf945146d2b6c37718ed3fbbbb6c4fd38839a37;p=thirdparty%2Ftvheadend.git ui: Add grouping format specifier for dates. When grouping recordings by datetime, each group tends to only have one recording since time field is unique. So, when grouping, we only use the date-portion and not the time portion in order to create the group. --- diff --git a/src/webui/static/app/idnode.js b/src/webui/static/app/idnode.js index 673a18b50..6fa2a0dae 100644 --- a/src/webui/static/app/idnode.js +++ b/src/webui/static/app/idnode.js @@ -339,6 +339,21 @@ tvheadend.IdNodeField = function(conf) props.renderer = Ext.ux.grid.CheckColumn.prototype.renderer; } + // Special handling for date/time fields. + if (ftype == 'date') + { + // When grouping, only use date and do not include + // timestamp, otherwise when grouping recordings, you can + // get hundreds of groups, each containing one recording. + // This format is for group section titles only, and not + // for normal display of dates nor for the display of + // dates inside of a group. + props.groupRenderer = function(v, m, r) { + var date = new Date(v*1000); + return date.toLocaleString(tvheadend.toLocaleFormat(), {weekday: 'short', day: 'numeric', month: 'long', year: 'numeric'}); + } + }; + return props; };