mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-18 05:34:09 +00:00
Refactor: better rounding (#1594)
This commit is contained in:
committed by
arc-alex
parent
421183fe55
commit
33ac05ebee
@@ -119,7 +119,7 @@ export function formatDuration(duration: number, hideSeconds = true): string {
|
||||
}
|
||||
|
||||
if (!hideSeconds) {
|
||||
const seconds = Math.floor((duration % MILLIS_PER_MINUTE) / MILLIS_PER_SECOND);
|
||||
const seconds = Math.ceil((duration % MILLIS_PER_MINUTE) / MILLIS_PER_SECOND);
|
||||
if (seconds > 0) {
|
||||
result += `${seconds}s`;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ export function getFormattedTimer(
|
||||
localisedMinutes: string,
|
||||
options: FormattingOptions,
|
||||
): string {
|
||||
if (timer == null) {
|
||||
if (timer == null || timerType === TimerType.None) {
|
||||
return options.removeSeconds ? timerPlaceholderMin : timerPlaceholder;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ export function getFormattedTimer(
|
||||
}
|
||||
}
|
||||
|
||||
let display = millisToString(timeToParse);
|
||||
let display = millisToString(timeToParse, { direction: timerType });
|
||||
if (options.removeLeadingZero) {
|
||||
display = removeLeadingZero(display);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user