]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
ui: Add grouping format specifier for dates.
authorE.Smith <31170571+azlm8t@users.noreply.github.com>
Wed, 19 Sep 2018 18:43:05 +0000 (19:43 +0100)
committerJaroslav Kysela <perex@perex.cz>
Thu, 20 Sep 2018 12:34:51 +0000 (14:34 +0200)
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.

src/webui/static/app/idnode.js

index 673a18b50a5ee853fbfdcc52a4649075584e7453..6fa2a0dae5f291d647b1ad362b8c3851f769809e 100644 (file)
@@ -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;
     };