kontakt: [email protected]
Widżet:Orgonity: Różnice pomiędzy wersjami
Przejdź do nawigacji
Przejdź do wyszukiwania
imported>Sługa szatana mNie podano opisu zmian |
imported>Sługa szatana mNie podano opisu zmian |
||
Linia 1: | Linia 1: | ||
<includeonly><script type="text/javascript"> | <includeonly><script type="text/javascript"> | ||
let format = interval => { | let format = arr => { | ||
let wynik = ""; | |||
return | let sec = interval / 1000; | ||
let [days, hours, minutes, seconds] = arr; | |||
if (days > 0) { | |||
wynik += days + " days, "; | |||
} | |||
if (hours > 0) { | |||
wynik += hours + " hours, "; | |||
} | |||
if (minutes > 0) { | |||
wynik += minutes + " minutes, "; | |||
} | |||
if (seconds > 0) { | |||
wynik += seconds + " seconds"; | |||
} | |||
return wynik; | |||
} | |||
let interval = i => { | |||
let sec = i / 1000; | |||
let days = Math.floor(sec / 86400); | |||
let hours = Math.floor(sec % 86400 / 3600); | |||
let minutes = Math.floor(sec % 3600 / 60); | |||
let seconds = Math.floor(sec % 60); | |||
return [days, hours, minutes, seconds]; | |||
} | } | ||
let a = new Date(); | let a = new Date(); | ||
Linia 11: | Linia 35: | ||
a.setDate(a.getDate() + (13 - a.getDay()) % 7); | a.setDate(a.getDate() + (13 - a.getDay()) % 7); | ||
let b = new Date(); | let b = new Date(); | ||
console.debug(format( | let r = interval(b - a); | ||
console.debug(format(r)); | |||
</script></includeonly> | </script></includeonly> |