Web: resolve #15 by converting UTC to local time for input limits

This commit is contained in:
2020-12-03 14:33:55 +01:00
committed by Oskar
parent 7a3682f866
commit 402dc27180
2 changed files with 20 additions and 7 deletions

View File

@ -227,12 +227,16 @@
}
var now = new Date()
var localISODate = new Date(now.getTime() -
(now.getTimezoneOffset() * 60000)).toISOString();
function localISOTimeMinutes(date) {
document.querySelector('input#end').value =
localISODate.split(':').slice(0,2).join(':')
var tzoffset = date.getTimezoneOffset() * 60000; //offset in milliseconds
var localISOTime = (new Date(date - tzoffset)).toISOString().slice(0, -1);
return localISOTime.split(':').slice(0,2).join(':')
}
document.querySelector('input#end').value = localISOTimeMinutes(new Date())
var scrollbox = document.querySelector('.scroll')
var timehead = document.querySelector('#timeheader')