Add better logic for progress and percentage

This commit is contained in:
Guilherme Cattani 2025-03-11 23:39:36 +01:00
parent 501d50f1b8
commit f22d1e383c

View file

@ -99,7 +99,7 @@ export default class ProgressBarPlugin extends Plugin {
.replace(/{total\((.*?)\)}/g, (_match: string, format: string) => totalDuration.toFormat(format));
infoText = infoText
.replace(/{percent}/g, Math.round(progress * 100).toString())
.replace(/{percent}/g, Math.floor(progress * 100).toString())
.replace(/{start}/g, startDate.toISODate() || '')
.replace(/{end}/g, endDate.toISODate() || '')
.replace(/{current}/g, currentDate.toISODate() || '')
@ -149,7 +149,7 @@ export default class ProgressBarPlugin extends Plugin {
if (progressType.toLowerCase() === 'countdown') {
bar.set(1.0 - progress);
} else {
bar.set(progress);
bar.set(Math.floor(progress * 100) / 100);
}
if (params.title) {