fix one tick off when resuming

This commit is contained in:
Julien Calixte
2023-04-20 23:19:00 +02:00
parent c810f35afd
commit a86ff582a2

View File

@@ -37,9 +37,15 @@ const duration = computed(() => {
return null
}
// When in pause, it can be a tick where now
// is behind new Date().
const mostRecentDate = new Date(
Math.max(new Date(now.value).getTime(), new Date().getTime())
)
return formatDiffInMinutes(
stepRecord.value.start,
stepRecord.value?.end ?? now.value
stepRecord.value?.end ?? toISODate(new Date(mostRecentDate))
)
})