fix event search combo
authorMichael Spahn <m.spahn@metaways.de>
Mon, 10 Jul 2017 08:28:05 +0000 (10:28 +0200)
committerMichael Spahn <m.spahn@metaways.de>
Mon, 10 Jul 2017 10:32:19 +0000 (12:32 +0200)
 - when cleared dtstart and dtend are no longer date objects

Change-Id: If7ee004b91ff936d97fa05319f87efcc43e5d879
Reviewed-on: http://gerrit.tine20.com/customers/5064
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Michael Spahn <m.spahn@metaways.de>
Tested-by: Michael Spahn <m.spahn@metaways.de>
tine20/Calendar/js/SearchCombo.js

index e1cdf15..7184510 100644 (file)
@@ -196,7 +196,16 @@ Tine.Calendar.SearchCombo = Ext.extend(Ext.ux.form.ClearableComboBox, {
                     },
                     encodeDate: function(values) {
                         var start = values.dtstart,
-                            end   = values.dtend;
+                            end   = values.dtend,
+                            _ = window.lodash;
+
+                        if (_.isString(start)) {
+                            start = new Date(start);
+                        }
+
+                        if (_.isString(end)) {
+                            end = new Date(end);
+                        }
 
                         var duration = values.is_all_day_event ? Tine.Tinebase.appMgr.get('Calendar').i18n._('whole day') : 
                                        Tine.Tinebase.common.minutesRenderer(Math.round((end.getTime() - start.getTime())/(1000*60)), '{0}:{1}', 'i');