Diagnostics: Adjust for timezone from webGUI

The filename generated by the webGUI's diagnostics wouldn't take into account the user's time zone.

Set the date / time according to the date / time on the browser
This commit is contained in:
Squidly271
2019-11-24 13:52:57 -05:00
committed by GitHub
parent 55bbb218af
commit 0ed90e4dda

View File

@@ -22,8 +22,9 @@ $zip = htmlspecialchars(str_replace(' ','_',strtolower($var['NAME'])));
<script>
function zipfile(){
var d = new Date();
return '<?=$zip?>-diagnostics-'+d.toISOString().substr(0,16).replace(/[-:]/g,'').replace('T','-')+'.zip';
var tzoffset = (new Date()).getTimezoneOffset() * 60000; //offset in milliseconds
var localISOTime = (new Date(Date.now() - tzoffset)).toISOString().slice(0, -1);
return '<?=$zip?>-diagnostics-'+localISOTime.substr(0,16).replace(/[-:]/g,'').replace('T','-')+'.zip';
}
function cleanUp(file) {
if (document.hasFocus()) {