Skip to content

Commit

Permalink
small tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov committed May 19, 2019
1 parent d0ab7a5 commit 254efe7
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
export function toTime (sec) {
sec = parseInt(sec, 10)
var hours = Math.floor(sec / 3600)
var minutes = Math.floor((sec - hours * 3600) / 60)
var seconds = sec - hours * 3600 - minutes * 60
let hours = Math.floor(sec / 3600)
let minutes = Math.floor((sec - hours * 3600) / 60)
if (hours < 10) {
hours = '0' + hours
}
if (minutes < 10) {
minutes = '0' + minutes
}
if (seconds < 10) {
seconds = '0' + seconds
}
return hours + ':' + minutes
}

export function batteryStats (battery) {
const percentage = parseFloat((battery.level * 100).toFixed(2)) + '%'
const charging = battery.charging
let fully
let remaining
let charging = battery.charging

if (charging && battery.chargingTime === Infinity) {
fully = 'Calculating...'
Expand Down

0 comments on commit 254efe7

Please sign in to comment.