diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2014-04-28 17:34:47 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2016-08-15 19:55:39 +0200 |
| commit | f4abfbb488c878f667181745f3347eadf0c88071 (patch) | |
| tree | 032ba4c958275a8f77f6a44544ff4bc290cf3064 /js/index.js | |
| parent | 7cb3015961d23c6d33aa5a9b882b09432361b211 (diff) | |
| download | wvs-vplan-f4abfbb488c878f667181745f3347eadf0c88071.tar.gz wvs-vplan-f4abfbb488c878f667181745f3347eadf0c88071.zip | |
fixe falsche Daten für Benachrichtigungen
Diffstat (limited to 'js/index.js')
| -rw-r--r-- | js/index.js | 14 |
1 files changed, 9 insertions, 5 deletions
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('<div id="' + name + '" class="tablist-content"></div>'); $('#vplantabs').tabs('refresh'); - $('#' + name).data('date', vdate.toString()); + $('#' + name).data('date', results[1]); if($('#login').length && wasdownloaded){ removelogintab(); |
