1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

feat: custom time intervals (resolve #115)

This commit is contained in:
Ferdinand Mütsch
2021-02-13 12:59:59 +01:00
parent daf67b844a
commit 30510591eb
14 changed files with 118 additions and 54 deletions

View File

@ -4,4 +4,9 @@ body {
.bg-gray-850 {
background-color: #242b3a;
}
::-webkit-calendar-picker-indicator {
filter: invert(1);
cursor: pointer;
}

View File

@ -49,6 +49,20 @@ String.prototype.toHHMMSS = function () {
return hours + ':' + minutes + ':' + seconds
}
String.prototype.toHHMM = function () {
var sec_num = parseInt(this, 10)
var hours = Math.floor(sec_num / 3600)
var minutes = Math.floor((sec_num - (hours * 3600)) / 60)
if (hours < 10 && hours > 0) {
hours = '0' + hours
}
if (minutes < 10 && minutes > 0) {
minutes = '0' + minutes
}
return hours + ':' + minutes
}
function draw(subselection) {
function getTooltipOptions(key) {
return {
@ -319,8 +333,9 @@ function equalizeHeights() {
function getTotal(items) {
const el = document.getElementById('total-span')
if (!el) return
let total = items.reduce((acc, d) => acc + d.total, 0)
el.innerText = total.toString().toHHMMSS()
const total = items.reduce((acc, d) => acc + d.total, 0)
const formatted = total.toString().toHHMM()
el.innerText = `${formatted.split(':')[0]} hours, ${formatted.split(':')[1]} minutes`
}
function getRandomColor(seed) {