error on invalid hours argument

master
Yorick van Pelt 2019-06-27 13:21:47 +02:00
Parent d7ae16d715
révision 46695b8236
Signé par: yorick
ID de la clé GPG: A36E70F9DC014A15
1 fichiers modifiés avec 3 ajouts et 0 suppressions

Voir le fichier

@ -206,6 +206,9 @@ class App {
async update(sheetname, startDate, endDate, hours) { // set values in sheet
console.log("Setting data in", sheetname)
hours = +hours
if (isNaN(hours)) {
throw "hours argument not a float or int"
}
const values = {
regular: Math.min(hours, 80),
overwork: Math.max(0, hours-80),