fix: incorrect ttl display

This commit is contained in:
Lykin 2024-01-25 14:26:48 +08:00
parent 5a86bab647
commit b610bd7861
2 changed files with 2 additions and 2 deletions

View File

@ -155,7 +155,7 @@ const onTTL = () => {
server: props.server, server: props.server,
db: props.db, db: props.db,
key: binaryKey.value ? props.keyCode : props.keyPath, key: binaryKey.value ? props.keyCode : props.keyPath,
ttl: props.ttl, ttl: ttl.value,
}) })
} }
</script> </script>

View File

@ -8,7 +8,7 @@ import { i18nGlobal } from '@/utils/i18n.js'
*/ */
export const toHumanReadable = (duration) => { export const toHumanReadable = (duration) => {
const dur = dayjs.duration(duration, 'seconds') const dur = dayjs.duration(duration, 'seconds')
const days = dur.days() const days = Math.floor(dur.asDays())
if (days > 0) { if (days > 0) {
return days + i18nGlobal.t('common.unit_day') + ' ' + dur.format('HH:mm:ss') return days + i18nGlobal.t('common.unit_day') + ' ' + dur.format('HH:mm:ss')
} else { } else {