mirror of
https://github.com/guicattani/obsidian-countdown-to.git
synced 2026-07-22 05:42:39 +00:00
Add better logic for progress and percentage
This commit is contained in:
parent
501d50f1b8
commit
f22d1e383c
1 changed files with 2 additions and 2 deletions
4
main.ts
4
main.ts
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue