From f4abfbb488c878f667181745f3347eadf0c88071 Mon Sep 17 00:00:00 2001 From: schneefux Date: Mon, 28 Apr 2014 17:34:47 +0200 Subject: fixe falsche Daten für Benachrichtigungen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/.index.js.swp | Bin 40960 -> 45056 bytes js/index.js | 14 +++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/js/.index.js.swp b/js/.index.js.swp index 1792131..3a7f14c 100644 Binary files a/js/.index.js.swp and b/js/.index.js.swp differ diff --git a/js/index.js b/js/index.js index 13ab09a..0e1b7d6 100644 --- a/js/index.js +++ b/js/index.js @@ -140,9 +140,9 @@ function fillform(){ /* benachrichtigt den Benutzer an vdate mit msg */ var notifications = 0; function addNotification(vdate, msg){ - vdate.subtract('days', $('#notifydayflip').val()); // Bei Bedarf einen Tag vorher + vdate = vdate.subtract('days', 1).add('days', $('#notifydayflip').val()); // Bei Bedarf einen Tag vorher - var secondsUntilDate = moment.diff(vdate, 'seconds'); + var secondsUntilDate = vdate.diff(moment(), 'seconds'); if(secondsUntilDate > 0){ localNotification.add(++notifications, { @@ -344,7 +344,11 @@ function renderPage($div, pdf, pageNumber, callback){ var vertretungen = parseVertretungen(page_text, username); if(vertretungen.length > 0){ - var vdate = moment($div.data('date')).startOf('minute').set('hour', $('#notifydate').val()); + var vdate = moment($div.data('date'), 'YYYY-MM-DD').startOf('second'); + var time = $('#notifydate').val().split(':'); + + vdate.set('hour', time[0]); + vdate.set('minute', time[1]); addNotification(vdate, vertretungen.join('\n')); addSocialButton(vdate, vertretungen.join(', '), $div); @@ -400,7 +404,7 @@ function removelogintab(){ $('#login').remove(); $('#vplantabs').tabs('refresh'); - var vdate = moment($('#vplantabs ul li:first').data('date')); + var vdate = moment($('#vplantabs ul li:first').data('date'), 'YYYY-MM-DD'); trackPlan(vdate); } @@ -448,7 +452,7 @@ function addplanattr(fileEntry, wasdownloaded){ $('#vplantabs').append('
'); $('#vplantabs').tabs('refresh'); - $('#' + name).data('date', vdate.toString()); + $('#' + name).data('date', results[1]); if($('#login').length && wasdownloaded){ removelogintab(); -- cgit v1.3.1