Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
AURA
dashboard
Commits
81033f44
Commit
81033f44
authored
May 19, 2018
by
Andrea Ida Malkah Klaura
Browse files
FIX: account for seconds in prettyDate functions
parent
18b132f9
Changes
2
Show whitespace changes
Inline
Side-by-side
src/components/ShowManager.vue
View file @
81033f44
...
...
@@ -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
=
"
' +
...
...
src/mixins/prettyDate.js
View file @
81033f44
...
...
@@ -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
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment