plugins/calendar

Thomas Brüderli bruederli at kolabsys.com
Wed Sep 19 10:58:34 CEST 2012


 plugins/calendar/calendar_ui.js |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

New commits:
commit 23ec4b8517d269cadc7ac5186d123ece6108f089
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Wed Sep 19 10:58:15 2012 +0200

    Fix ISO date formatting and prevent events from disappearing while saving is in process

diff --git a/plugins/calendar/calendar_ui.js b/plugins/calendar/calendar_ui.js
index f835f01..750365f 100644
--- a/plugins/calendar/calendar_ui.js
+++ b/plugins/calendar/calendar_ui.js
@@ -125,8 +125,13 @@ function rcube_calendar_ui(settings)
     // turn the given date into an ISO 8601 date string understandable by PHPs strtotime()
     var date2servertime = function(date)
     {
-      return date.getFullYear()+'-'+(date.getMonth()+1)+'-'+date.getDate()
-          + 'T'+date.getHours()+':'+date.getMinutes()+':'+date.getSeconds();
+      return date.getFullYear()+'-'+zeropad(date.getMonth()+1)+'-'+zeropad(date.getDate())
+          + 'T'+zeropad(date.getHours())+':'+zeropad(date.getMinutes())+':'+zeropad(date.getSeconds());
+    }
+
+    var zeropad = function(num)
+    {
+        return (num < 10 ? '0' : '') + num;
     }
 
     // determine whether the given date is on a weekend
@@ -1459,9 +1464,9 @@ function rcube_calendar_ui(settings)
       if ((data.start && data.end) || data.id) {
         var event = data.id ? $.extend(fc.fullCalendar('clientEvents', function(e){ return e.id == data.id; })[0], data) : data;
         if (data.start)
-          event.start = fromunixtime(data.start);
+          event.start = data.start;
         if (data.end)
-          event.end = fromunixtime(data.end);
+          event.end = data.end;
         if (data.allday !== undefined)
           event.allDay = data.allday;
         event.editable = false;





More information about the commits mailing list