~trimardio/widelands-website/scheduler_utc_fix

« back to all changes in this revision

Viewing changes to wlscheduling/static/js/scheduling.js

  • Committer: gschmitlin at gmail
  • Date: 2019-06-30 17:42:58 UTC
  • Revision ID: gschmitlin@gmail.com-20190630174258-33c130yomwi0yjsu
fix displayed hour from other users

Show diffs side-by-side

added added

removed removed

Lines of Context:
171
171
}
172
172
 
173
173
function createUserDivOrUpdateIt(user, availTime) {
 
174
    // Create User div
174
175
    if (!document.getElementById("user-" + user)){
175
176
        var original = document.getElementById('other-user-template');
176
177
        // We clone the date and fix different attributes
201
202
    } else {
202
203
        otherUser = document.getElementById("user-" + user);
203
204
    }
 
205
    // get exact hour from string 
204
206
    var dtavailTime = new Date(availTime + ":00:00");
205
 
    // Remove timezone offset which js automatically add...
206
 
    js_offset = dtavailTime.getTimezoneOffset()/60
207
 
    dtavailTime = dtavailTime.addHours(js_offset);
208
207
    textDate = dtavailTime.toDateString();
209
208
    var dateFormated = dtavailTime.getFullYear() + "-" + dtavailTime.getMonth() + '-' + dtavailTime.getDay()
210
209
    var availTimeFormated = dtavailTime.getHours()