mirror of
https://github.com/Ellpeck/ObsidianSimpleTimeTracker.git
synced 2024-11-16 07:23:12 +01:00
Updated formatting of duration to allow for more than 1 24 hour day durations.
This commit is contained in:
parent
402b97c799
commit
85ee96f5dd
2 changed files with 18 additions and 0 deletions
|
@ -204,6 +204,12 @@ function formatTimestamp(timestamp: number, settings: SimpleTimeTrackerSettings)
|
|||
function formatDuration(totalTime: number): string {
|
||||
let duration = moment.duration(totalTime);
|
||||
let ret = "";
|
||||
if (duration.years() > 0)
|
||||
ret += duration.years() + "y ";
|
||||
if (duration.months() > 0)
|
||||
ret += duration.months() + "m ";
|
||||
if (duration.days() > 0)
|
||||
ret += duration.days() + "d ";
|
||||
if (duration.hours() > 0)
|
||||
ret += duration.hours() + "h ";
|
||||
if (duration.minutes() > 0)
|
||||
|
|
12
test-vault/duration_accumulation_test.md
Normal file
12
test-vault/duration_accumulation_test.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Notes
|
||||
More notes for my cool project! This note shows that we can correctly display accumulated time that lasts longer than a 24 hour day!
|
||||
|
||||
```simple-time-tracker
|
||||
{"entries":[
|
||||
{"name":"test","startTime":1596265200,"endTime":1627887600,"subEntries":null},
|
||||
{"name":"test","startTime":1627801200,"endTime":1633158000,"subEntries":null},
|
||||
{"name":"test","startTime":1659337200,"endTime":1659423600,"subEntries":null},
|
||||
{"name":"test","startTime":1664627410,"endTime":1664631605,"subEntries":null}
|
||||
|
||||
]}
|
||||
```
|
Loading…
Reference in a new issue