Skip to content

Commit

Permalink
[web] Remove leading zero in time representations
Browse files Browse the repository at this point in the history
  • Loading branch information
hacketiwack committed Dec 7, 2023
1 parent 49c4984 commit e836378
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions web-src/src/filter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,8 @@ const { t, locale } = i18n.global

export const filters = {
durationInHours(value_ms) {
const seconds = Math.floor(value_ms / 1000)
if (seconds > 3600) {
return Duration.fromObject({ seconds })
.shiftTo('hours', 'minutes', 'seconds')
.toFormat('hh:mm:ss')
}
return Duration.fromObject({ seconds })
.shiftTo('minutes', 'seconds')
.toFormat('mm:ss')
const format = value_ms >= 3600000 ? 'h:mm:ss' : 'm:ss'
return Duration.fromMillis(value_ms).toFormat(format)
},

durationInDays(value_ms) {
Expand Down Expand Up @@ -44,7 +37,6 @@ export const filters = {

timeFromNow(value) {
const diff = DateTime.now().diff(DateTime.fromISO(value))

return this.durationInDays(diff.as('milliseconds'))
},

Expand Down

0 comments on commit e836378

Please sign in to comment.