Skip to content

Commit

Permalink
Fixes to resolve tiezone related issues OpenEVSE#167 and a better fix…
Browse files Browse the repository at this point in the history
… for OpenEVSE#170
  • Loading branch information
jeremypoulter committed Apr 8, 2018
1 parent a40e394 commit 71473ba
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/html/view_models/TimeViewModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ function TimeViewModel(openevse)
return "";
}

return self.nowTimedate().toISOString().split("T")[0];
var dt = self.nowTimedate();
return (dt.getFullYear() + 1900)+"-"+addZero(dt.getMonth())+"-"+addZero(dt.getDate());
},
write: function (val) {
self.evseTimedate(new Date(val));
Expand All @@ -65,8 +66,13 @@ function TimeViewModel(openevse)
if(null === self.nowTimedate()) {
return "0:00:00";
}
var dt = self.elapsedNow();
return addZero(dt.getUTCHours())+":"+addZero(dt.getMinutes())+":"+addZero(dt.getSeconds());
var time = self.elapsedNow().getTime();
time = Math.round(time / 1000);
var seconds = time % 60;
time = Math.round(time / 60);
var minutes = time % 60;
var hours = Math.round(time / 60);
return hours+":"+addZero(minutes)+":"+addZero(seconds);
});

openevse.status.elapsed.subscribe(function (val) {
Expand Down

0 comments on commit 71473ba

Please sign in to comment.