Commit 81033f44 authored by Andrea Ida Malkah Klaura's avatar Andrea Ida Malkah Klaura
Browse files

FIX: account for seconds in prettyDate functions

parent 18b132f9
......@@ -323,7 +323,7 @@ export default {
arr.push({
title: note,
starts: this.prettyDateTime(this.current.timeslots[i].start),
duration: this.prettyDuration(this.current.timeslots[i].start, this.current.timeslots[i].end) + 'min',
duration: this.prettyDuration(this.current.timeslots[i].start, this.current.timeslots[i].end),
// TODO: find out how to insert images or iconffont icons into b-table rows
// options: '<img src="../assets/16x16/emblem-system.png" alt="edit note" v-on:click="' + this.editTimeslotNote(this.current.timeslots[i].id) + '" />'
options: '<span class="timeslotEditLink" onclick="' +
......
......@@ -55,19 +55,19 @@ export default {
dstring += leadingZero(d.getDate()) + '. '
dstring += month[d.getMonth()] + ' '
dstring += d.getFullYear() + ', '
dstring += leadingZero(d.getHours()) + ':' + leadingZero(d.getMinutes())
dstring += leadingZero(d.getHours()) + ':' + leadingZero(d.getMinutes()) + ':' + leadingZero(d.getSeconds())
return dstring
},
prettyDuration: function (start, end) {
var duration = (new Date(end).getTime() - new Date(start).getTime()) / 1000
/*
// This is the old notation in HH:MM - have to decide which one to use in final design
var hours = Math.floor(duration / 60 / 60)
var minutes = (duration / 60) % 60
return leadingZero(hours) + ':' + leadingZero(minutes)
*/
// Here we just return the duration in minutes
return duration / 60
var seconds = (new Date(end).getTime() - new Date(start).getTime()) / 1000
var minutes = Math.floor(seconds / 60)
var duration = minutes + 'min'
if (minutes < seconds / 60) {
duration += ' '
duration += seconds - 60 * minutes
duration += 'sec'
}
return duration
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment