diff --git a/js/plot.js b/js/plot.js index 770383d..ce63e58 100644 --- a/js/plot.js +++ b/js/plot.js @@ -2,15 +2,13 @@ window.onload = function() { var required = [], paid = []; var today = new Date(), year = 1900 + today.getYear(), - month = today.getMonth(); + month = today.getMonth() + 1; for(i = 0; i < 12; ++i) { var xhr = new XMLHttpRequest(); xhr.open("GET", 'https://kasownik.hackerspace.pl/api/month/' + year + '/' + month + '.json', false); xhr.send(); var res = JSON.parse(xhr.response).content, - date = new Date(); - date.setYear(year); - date.setMonth(month); + date = new Date(year, month, 1); required.unshift({ x: date.getTime() / 1000, y: res.required }); paid.unshift({ x: date.getTime() / 1000, y: res.paid }); month -= 1;