From b5e768d99c9b8870e39819ea2ecdda20fc4813a1 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 23 May 2023 18:18:28 +0200 Subject: [PATCH] added a setting to make duration displays less fine-grained closes #15 --- src/settings-tab.ts | 11 ++++ src/settings.ts | 4 +- src/tracker.ts | 42 ++++++++------ test-vault/.obsidian/core-plugins.json | 2 +- .../plugins/simple-time-tracker/data.json | 5 +- .../plugins/simple-time-tracker/main | 58 ++++++++++++------- .../plugins/simple-time-tracker/main.js | 55 +++++++++++------- test-vault/duration_accumulation_test.md | 7 +-- 8 files changed, 113 insertions(+), 71 deletions(-) diff --git a/src/settings-tab.ts b/src/settings-tab.ts index f39dcb2..64c6b1f 100644 --- a/src/settings-tab.ts +++ b/src/settings-tab.ts @@ -41,6 +41,17 @@ export class SimpleTimeTrackerSettingsTab extends PluginSettingTab { }); }); + new Setting(this.containerEl) + .setName("Fine-Grained Durations") + .setDesc("Whether durations should include days, months and years. If this is disabled, additional time units will be displayed as part of the hours.") + .addToggle(t => { + t.setValue(this.plugin.settings.fineGrainedDurations); + t.onChange(async v => { + this.plugin.settings.fineGrainedDurations = v; + await this.plugin.saveSettings(); + }); + }); + this.containerEl.createEl("hr"); this.containerEl.createEl("p", {text: "If you like this plugin and want to support its development, you can do so through my website by clicking this fancy image!"}); this.containerEl.createEl("a", {href: "https://ellpeck.de/support"}) diff --git a/src/settings.ts b/src/settings.ts index 2a59e68..a8c2c31 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -1,11 +1,13 @@ export const defaultSettings: SimpleTimeTrackerSettings = { timestampFormat: "YY-MM-DD hh:mm:ss", - csvDelimiter: "," + csvDelimiter: ",", + fineGrainedDurations: true }; export interface SimpleTimeTrackerSettings { timestampFormat: string; csvDelimiter: string; + fineGrainedDurations: boolean; } diff --git a/src/tracker.ts b/src/tracker.ts index b4681ac..0437ea0 100644 --- a/src/tracker.ts +++ b/src/tracker.ts @@ -93,14 +93,14 @@ export function displayTracker(tracker: Tracker, element: HTMLElement, file: str } - setCountdownValues(tracker, current, total, currentDiv); + setCountdownValues(tracker, current, total, currentDiv, settings); let intervalId = window.setInterval(() => { // we delete the interval timer when the element is removed if (!element.isConnected) { window.clearInterval(intervalId); return; } - setCountdownValues(tracker, current, total, currentDiv); + setCountdownValues(tracker, current, total, currentDiv, settings); }, 1000); } @@ -186,32 +186,38 @@ function getTotalDuration(entries: Entry[]): number { return ret; } -function setCountdownValues(tracker: Tracker, current: HTMLElement, total: HTMLElement, currentDiv: HTMLDivElement) { +function setCountdownValues(tracker: Tracker, current: HTMLElement, total: HTMLElement, currentDiv: HTMLDivElement, settings: SimpleTimeTrackerSettings) { let running = getRunningEntry(tracker.entries); if (running && !running.endTime) { - current.setText(formatDuration(getDuration(running))); + current.setText(formatDuration(getDuration(running), settings)); currentDiv.hidden = false; } else { currentDiv.hidden = true; } - total.setText(formatDuration(getTotalDuration(tracker.entries))); + total.setText(formatDuration(getTotalDuration(tracker.entries), settings)); } function formatTimestamp(timestamp: number, settings: SimpleTimeTrackerSettings): string { return moment.unix(timestamp).format(settings.timestampFormat); } -function formatDuration(totalTime: number): string { - let duration = moment.duration(totalTime); +function formatDuration(totalTime: number, settings: SimpleTimeTrackerSettings): string { 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 "; + let duration = moment.duration(totalTime); + let hours: number; + if (settings.fineGrainedDurations) { + if (duration.years() > 0) + ret += duration.years() + "y "; + if (duration.months() > 0) + ret += duration.months() + "M "; + if (duration.days() > 0) + ret += duration.days() + "d "; + hours = duration.hours(); + } else { + hours = Math.floor(duration.asHours()); + } + if (hours > 0) + ret += hours + "h "; if (duration.minutes() > 0) ret += duration.minutes() + "m "; ret += duration.seconds() + "s"; @@ -222,7 +228,7 @@ function createMarkdownTable(tracker: Tracker, settings: SimpleTimeTrackerSettin let table = [["Segment", "Start time", "End time", "Duration"]]; for (let entry of tracker.entries) table.push(...createTableSection(entry, settings)); - table.push(["**Total**", "", "", `**${formatDuration(getTotalDuration(tracker.entries))}**`]); + table.push(["**Total**", "", "", `**${formatDuration(getTotalDuration(tracker.entries), settings)}**`]); let ret = ""; // calculate the width every column needs to look neat when monospaced @@ -254,7 +260,7 @@ function createTableSection(entry: Entry, settings: SimpleTimeTrackerSettings): entry.name, entry.startTime ? formatTimestamp(entry.startTime, settings) : "", entry.endTime ? formatTimestamp(entry.endTime, settings) : "", - entry.endTime || entry.subEntries ? formatDuration(getDuration(entry)) : ""]]; + entry.endTime || entry.subEntries ? formatDuration(getDuration(entry), settings) : ""]]; if (entry.subEntries) { for (let sub of entry.subEntries) ret.push(...createTableSection(sub, settings)); @@ -273,7 +279,7 @@ function addEditableTableRow(tracker: Tracker, entry: Entry, table: HTMLTableEle row.createEl("td", {text: entry.startTime ? formatTimestamp(entry.startTime, settings) : ""}); row.createEl("td", {text: entry.endTime ? formatTimestamp(entry.endTime, settings) : ""}); - row.createEl("td", {text: entry.endTime || entry.subEntries ? formatDuration(getDuration(entry)) : ""}); + row.createEl("td", {text: entry.endTime || entry.subEntries ? formatDuration(getDuration(entry), settings) : ""}); let entryButtons = row.createEl("td"); if (!running) { diff --git a/test-vault/.obsidian/core-plugins.json b/test-vault/.obsidian/core-plugins.json index 90b8eac..9405bfd 100644 --- a/test-vault/.obsidian/core-plugins.json +++ b/test-vault/.obsidian/core-plugins.json @@ -17,4 +17,4 @@ "outline", "word-count", "file-recovery" -] +] \ No newline at end of file diff --git a/test-vault/.obsidian/plugins/simple-time-tracker/data.json b/test-vault/.obsidian/plugins/simple-time-tracker/data.json index 590b799..a89c0a8 100644 --- a/test-vault/.obsidian/plugins/simple-time-tracker/data.json +++ b/test-vault/.obsidian/plugins/simple-time-tracker/data.json @@ -1,4 +1,5 @@ { "timestampFormat": "YY-MM-DD hh:mm:ss", - "csvDelimiter": "," -} + "csvDelimiter": ",", + "fineGrainedDurations": false +} \ No newline at end of file diff --git a/test-vault/.obsidian/plugins/simple-time-tracker/main b/test-vault/.obsidian/plugins/simple-time-tracker/main index 31f0db7..4c26e94 100644 --- a/test-vault/.obsidian/plugins/simple-time-tracker/main +++ b/test-vault/.obsidian/plugins/simple-time-tracker/main @@ -72,7 +72,8 @@ var import_obsidian3 = __toModule(require("obsidian")); // src/settings.ts var defaultSettings = { timestampFormat: "YY-MM-DD hh:mm:ss", - csvDelimiter: "," + csvDelimiter: ",", + fineGrainedDurations: true }; // src/settings-tab.ts @@ -103,6 +104,13 @@ var SimpleTimeTrackerSettingsTab = class extends import_obsidian.PluginSettingTa yield this.plugin.saveSettings(); })); }); + new import_obsidian.Setting(this.containerEl).setName("Fine-Grained Durations").setDesc("Whether durations should include days, months and years. If this is disabled, additional time units will be displayed as part of the hours.").addToggle((t) => { + t.setValue(this.plugin.settings.fineGrainedDurations); + t.onChange((v) => __async(this, null, function* () { + this.plugin.settings.fineGrainedDurations = v; + yield this.plugin.saveSettings(); + })); + }); this.containerEl.createEl("hr"); this.containerEl.createEl("p", { text: "If you like this plugin and want to support its development, you can do so through my website by clicking this fancy image!" }); this.containerEl.createEl("a", { href: "https://ellpeck.de/support" }).createEl("img", { @@ -168,13 +176,13 @@ function displayTracker(tracker, element, file, getSectionInfo, settings) { new import_obsidian2.ButtonComponent(buttons).setButtonText("Copy as table").onClick(() => navigator.clipboard.writeText(createMarkdownTable(tracker, settings))); new import_obsidian2.ButtonComponent(buttons).setButtonText("Copy as CSV").onClick(() => navigator.clipboard.writeText(createCsv(tracker, settings))); } - setCountdownValues(tracker, current, total, currentDiv); + setCountdownValues(tracker, current, total, currentDiv, settings); let intervalId = window.setInterval(() => { if (!element.isConnected) { window.clearInterval(intervalId); return; } - setCountdownValues(tracker, current, total, currentDiv); + setCountdownValues(tracker, current, total, currentDiv, settings); }, 1e3); } function startSubEntry(entry, name) { @@ -246,30 +254,36 @@ function getTotalDuration(entries) { ret += getDuration(entry); return ret; } -function setCountdownValues(tracker, current, total, currentDiv) { +function setCountdownValues(tracker, current, total, currentDiv, settings) { let running = getRunningEntry(tracker.entries); if (running && !running.endTime) { - current.setText(formatDuration(getDuration(running))); + current.setText(formatDuration(getDuration(running), settings)); currentDiv.hidden = false; } else { currentDiv.hidden = true; } - total.setText(formatDuration(getTotalDuration(tracker.entries))); + total.setText(formatDuration(getTotalDuration(tracker.entries), settings)); } function formatTimestamp(timestamp, settings) { return import_obsidian2.moment.unix(timestamp).format(settings.timestampFormat); } -function formatDuration(totalTime) { - let duration = import_obsidian2.moment.duration(totalTime); +function formatDuration(totalTime, settings) { 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 "; + let duration = import_obsidian2.moment.duration(totalTime); + let hours; + if (settings.fineGrainedDurations) { + if (duration.years() > 0) + ret += duration.years() + "y "; + if (duration.months() > 0) + ret += duration.months() + "M "; + if (duration.days() > 0) + ret += duration.days() + "d "; + hours = duration.hours(); + } else { + hours = Math.floor(duration.asHours()); + } + if (hours > 0) + ret += hours + "h "; if (duration.minutes() > 0) ret += duration.minutes() + "m "; ret += duration.seconds() + "s"; @@ -279,16 +293,16 @@ function createMarkdownTable(tracker, settings) { let table = [["Segment", "Start time", "End time", "Duration"]]; for (let entry of tracker.entries) table.push(...createTableSection(entry, settings)); - table.push(["**Total**", "", "", `**${formatDuration(getTotalDuration(tracker.entries))}**`]); + table.push(["**Total**", "", "", `**${formatDuration(getTotalDuration(tracker.entries), settings)}**`]); let ret = ""; let widths = Array.from(Array(4).keys()).map((i) => Math.max(...table.map((a) => a[i].length))); for (let r = 0; r < table.length; r++) { if (r == 1) - ret += Array.from(Array(4).keys()).map((i) => "-".repeat(widths[i])).join(" | ") + "\n"; + ret += "| " + Array.from(Array(4).keys()).map((i) => "-".repeat(widths[i])).join(" | ") + " |\n"; let row = []; for (let i = 0; i < 4; i++) row.push(table[r][i].padEnd(widths[i], " ")); - ret += row.join(" | ") + "\n"; + ret += "| " + row.join(" | ") + " |\n"; } return ret; } @@ -305,7 +319,7 @@ function createTableSection(entry, settings) { entry.name, entry.startTime ? formatTimestamp(entry.startTime, settings) : "", entry.endTime ? formatTimestamp(entry.endTime, settings) : "", - entry.endTime || entry.subEntries ? formatDuration(getDuration(entry)) : "" + entry.endTime || entry.subEntries ? formatDuration(getDuration(entry), settings) : "" ]]; if (entry.subEntries) { for (let sub of entry.subEntries) @@ -322,7 +336,7 @@ function addEditableTableRow(tracker, entry, table, newSegmentNameBox, running, nameBox.inputEl.hidden = true; row.createEl("td", { text: entry.startTime ? formatTimestamp(entry.startTime, settings) : "" }); row.createEl("td", { text: entry.endTime ? formatTimestamp(entry.endTime, settings) : "" }); - row.createEl("td", { text: entry.endTime || entry.subEntries ? formatDuration(getDuration(entry)) : "" }); + row.createEl("td", { text: entry.endTime || entry.subEntries ? formatDuration(getDuration(entry), settings) : "" }); let entryButtons = row.createEl("td"); if (!running) { new import_obsidian2.ButtonComponent(entryButtons).setClass("clickable-icon").setIcon(`lucide-play`).setTooltip("Continue").onClick(() => __async(this, null, function* () { @@ -388,4 +402,4 @@ var SimpleTimeTrackerPlugin = class extends import_obsidian3.Plugin { }); } }; -//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsic3JjL21haW4udHMiLCAic3JjL3NldHRpbmdzLnRzIiwgInNyYy9zZXR0aW5ncy10YWIudHMiLCAic3JjL3RyYWNrZXIudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImltcG9ydCB7IFBsdWdpbiB9IGZyb20gXCJvYnNpZGlhblwiO1xyXG5pbXBvcnQgeyBkZWZhdWx0U2V0dGluZ3MsIFNpbXBsZVRpbWVUcmFja2VyU2V0dGluZ3MgfSBmcm9tIFwiLi9zZXR0aW5nc1wiO1xyXG5pbXBvcnQgeyBTaW1wbGVUaW1lVHJhY2tlclNldHR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sgaW50byBvdXIgbWFpbiBlbnRyeVxyXG4gICAgICAgICAgICAgICAgaWYgKGVudHJ5LnN1YkVudHJpZXMubGVuZ3RoID09IDEpIHtcclxuICAgICAgICAgICAgICAgICAgICBsZXQgc2luZ2xlID0gZW50cnkuc3ViRW50cmllc1swXTtcclxuICAgICAgICAgICAgICAgICAgICBlbnRyeS5zdGFydFRpbWUgPSBzaW5nbGUuc3RhcnRUaW1lO1xyXG4gICAgICAgICAgICAgICAgICAgIGVudHJ5LmVuZFRpbWUgPSBzaW5nbGUuZW5kVGltZTtcclxuICAgICAgICAgICAgICAgICAgICBlbnRyeS5zdWJFbnRyaWVzID0gbnVsbDtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHJldHVybiB0cnVlO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG4gICAgfVxyXG4gICAgcmV0dXJuIGZhbHNlO1xyXG59XHJcblxyXG5mdW5jdGlvbiBpc1J1bm5pbmcodHJhY2tlcjogVHJhY2tlcik6IGJvb2xlYW4ge1xyXG4gICAgcmV0dXJuICEhZ2V0UnVubmluZ0VudHJ5KHRyYWNrZXIuZW50cmllcyk7XHJcbn1cclxuXHJcbmZ1bmN0aW9uIGdldFJ1bm5pbmdFbnRyeShlbnRyaWVzOiBFbnRyeVtdKTogRW50cnkge1xyXG4gICAgZm9yIChsZXQgZW50cnkgb2YgZW50cmllcykge1xyXG4gICAgICAgIC8vIGlmIHRoaXMgZW50cnkgaGFzIHN1YiBlbnRyaWVzLCBjaGVjayBpZiBvbmUgb2YgdGhlbSBpcyBydW5uaW5nXHJcbiAgICAgICAgaWYgKGVudHJ5LnN1YkVudHJpZXMpIHtcclxuICAgICAgICAgICAgbGV0IHJ1bm5pbmcgPSBnZXRSdW5uaW5nRW50cnkoZW50cnkuc3ViRW50cmllcyk7XHJcbiAgICAgICAgICAgIGlmIChydW5uaW5nKVxyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHJ1bm5pb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RJY29uKGBsdWNpZGUtcGxheWApXHJcbiAgICAgICAgICAgIC5zZXRUb29sdGlwKFwiQ29udGludWVcIilcclxuICAgICAgICAgICAgLm9uQ2xpY2soYXN5bmMgKCkgPT4ge1xyXG4gICAgICAgICAgICAgICAgc3RhcnRTdWJFbnRyeShlbnRyeSwgbmV3U2VnbWVudE5hbWVCb3guZ2V0VmFsdWUoKSk7XHJcbiAgICAgICAgICAgICAgICBhd2FpdCBzYXZlVHJhY2tlcih0cmFja2VyLCB0aGlzLmFwcCwgZmlsZSwgZ2V0U2VjdGlvbkluZm8oKSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgfVxyXG4gICAgbGV0IGVkaXRCdXR0b24gPSBuZXcgQnV0dG9uQ29tcG9uZW50KGVudHJ5QnV0dG9ucylcclxuICAgICAgICAuc2V0Q2xhc3MoXCJjbGlja2FibGUtaWNvblwiKVxyXG4gICAgICAgIC5zZXRUb29sdGlwKFwiRWRpdFwiKVxyXG4gICAgICAgIC5zZXRJY29uKFwibHVjaWRlLXBlbmNpbFwiKVxyXG4gICAgICAgIC5vbkNsaWNrKGFzeW5jICgpID0+IHtcclxuICAgICAgICAgICAgaWYgKG5hbWVQYXIuaGlkZGVuKSB7XHJcbiAgICAgICAgICAgICAgICBuYW1lUGFyLmhpZGRlbiA9IGZhbHNlO1xyXG4gICAgICAgICAgICAgICAgbmFtZUJveC5pbnB1dEVsLmhpZGRlbiA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICBlZGl0QnV0dG9uLnNldEljb24oXCJsdWNpZGUtcGVuY2lsXCIpO1xyXG4gICAgICAgICAgICAgICAgaWYgKG5hbWVCb3guZ2V0VmFsdWUoKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIGVudHJ5Lm5hbWUgPSBuYW1lQm94LmdldFZhbHVlKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgbmFtZVBhci5zZXRUZXh0KGVudHJ5Lm5hbWUpO1xyXG4gICAgICAgICAgICAgICAgICAgIGF3YWl0IHNhdmVUcmFja2VyKHRyYWNrZXIsIHRoaXMuYXBwLCBmaWxlLCBnZXRTZWN0aW9uSW5mbygpKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIG5hbWVQYXIuaGlkZGVuID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgIG5hbWVCb3guaW5wdXRFbC5oaWRkZW4gPSBmYWxzZTtcclxuICAgICAgICAgICAgICAgIG5hbWVCb3guc2V0VmFsdWUoZW50cnkubmFtZSk7XHJcbiAgICAgICAgICAgICAgICBlZGl0QnV0dG9uLnNldEljb24oXCJsdWNpZGUtY2hlY2tcIik7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9KTtcclxuICAgIG5ldyBCdXR0b25Db21wb25lbnQoZW50cnlCdXR0b25zKVxyXG4gICAgICAgIC5zZXRDbGFzcyhcImNsaWNrYWJsZS1pY29uXCIpXHJcbiAgICAgICAgLnNldFRvb2x0aXAoXCJSZW1vdmVcIilcclxuICAgICAgICAuc2V0SWNvbihcImx1Y2lkZS10cmFzaFwiKVxyXG4gICAgICAgIC5vbkNsaWNrKGFzeW5jICgpID0+IHtcclxuICAgICAgICAgICAgcmVtb3ZlRW50cnkodHJhY2tlci5lbnRyaWVzLCBlbnRyeSk7XHJcbiAgICAgICAgICAgIGF3YWl0IHNhdmVUcmFja2VyKHRyYWNrZXIsIHRoaXMuYXBwLCBmaWxlLCBnZXRTZWN0aW9uSW5mbygpKTtcclxuICAgICAgICB9KTtcclxuXHJcbiAgICBpZiAoZW50cnkuc3ViRW50cmllcykge1xyXG4gICAgICAgIGZvciAobGV0IHN1YiBvZiBlbnRyeS5zdWJFbnRyaWVzKVxyXG4gICAgICAgICAgICBhZGRFZGl0YWJsZVRhYmxlUm93KHRyYWNrZXIsIHN1YiwgdGFibGUsIG5ld1NlZ21lbnROYW1lQm94LCBydW5uaW5nLCBmaWxlLCBnZXRTZWN0aW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xyXG4gICAgICAgIHRyeSB7XHJcbiAgICAgICAgICAgIHJldHVybiBKU09OLnBhcnNlKGpzb24pO1xyXG4gICAgICAgIH0gY2F0Y2ggKGUpIHtcclxuICAgICAgICAgICAgY29uc29sZS5sb2coYEZhaWxlZCB0byBwYXJzZSBUcmFja2VyIGZyb20gJHtqc29ufWApO1xyXG4gICAgICAgIH1cclxuICAgIH1cclxuICAgIHJldHVybiB7ZW50cmllczogW119O1xyXG59XHJcblxyXG5leHBvcnQgZnVuY3Rpb24gZGlzcGxheVRyYWNrZXIodHJhY2tlcjogVHJhY2tlciwgZWxlbWVudDogSFRNTEVsZW1lbnQsIGZpbGU6IHN0cmluZywgZ2V0U2VjdGlvbkluZm86ICgpID0+IE1hcmtkb3duU2VjdGlvbkluZm9ybWF0aW9uLCBzZXR0aW5nczogU2ltcGxlVGltZVRyYWNrZXJTZXR0aW5ncyk6IHZvaWQge1xyXG4gICAgLy8gYWRkIHN0YXJ0L3N0b3AgY29udHJvbHNcclxuICAgIGxldCBydW5uaW5nID0gaXNSdW5uaW5nKHRyYWNrZXIpO1xyXG4gICAgbGV0IGJ0biA9IG5ldyBCdXR0b25Db21wb25lbnQoZWxlbWVudClcclxuICAgICAgICAuc2V0Q2xhc3MoXCJjbGlja2FibGUtaWNvblwiKVxyXG4gICAgICAgIC5zZXRJY29uKGBsdWNpZGUtJHtydW5uaW5nID8gXCJzdG9wXCIgOiBcInBsYXlcIn0tY2lyY2xlYClcclxuICAgICAgICAuc2V0VG9vbHRpcChydW5uaW5nID8gXCJFbmRcIiA6IFwiU3RhcnRcIilcclxuICAgICAgICAub25DbGljayhhc3luYyAoKSA9PiB7XHJcbiAgICAgICAgICAgIGlmIChydW5uaW5nKSB7XHJcbiAgICAgICAgICAgICAgICBlbmRSdW5uaW5nRW50cnkodHJhY2tlcik7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBzdGFydE5ld0VudHJ5KHRyYWNrZXIsIG5ld1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bnRyaWVzLnB1c2goZW50cnkpO1xyXG59XHJcblxyXG5mdW5jdGlvbiBlbmRSdW5uaW5nRW50cnkodHJhY2tlcjogVHJhY2tlcik6IHZvaWQge1xyXG4gICAgbGV0IGVudHJ5ID0gZ2V0UnVubmluZ0VudHJ5KHRyYWNrZXIuZW50cmllcyk7XHJcbiAgICBlbnRyeS5lbmRUaW1lID0gbW9tZW50KCkudW5peCgpO1xyXG59XHJcblxyXG5mdW5jdGlvbiByZW1vdmVFbnRyeShlbnRyaWVzOiBFbnRyeVtdLCB0b1JlbW92ZTogRW50cnkpOiBib29sZWFuIHtcclxuICAgIGlmIChlbnRyaWVzLmNvbnRhaW5zKHRvUmVtb3ZlKSkge1xyXG4gICAgICAgIGVudHJpZXMucmVtb3ZlKHRvUmVtb3ZlKTtcclxuICAgICAgICByZXR1cm4gdHJ1ZTtcclxuICAgIH0gZWxzZSB7XHJcbiAgICAgICAgZm9yIChsZXQgZW50cnkgb2YgZW50cmllcykge1xyXG4gICAgICAgICAgICBpZiAoZW50cnkuc3ViRW50cmllcyAmJiByZW1vdmVFbnRyeShlbnRyeS5zdWJFbnRyaWVzLCB0b1JlbW92ZSkpIHtcclxuICAgICAgICAgICAgICAgIC8vIGlmIHdlIG9ubHkgaGF2ZSBvbmUgc3ViIGVudHJ5IHJlbWFpbmluZywgd2UgY2FuIG1lcmdlIGJhY2sgaW50byBvdXIgbWFpbiBlbnRyeVxyXG4gICAgICAgICAgICAgICAgaWYgKGVudHJ5LnN1YkVudHJpZXMubGVuZ3RoID09IDEpIHtcclxuICAgICAgICAgICAgICAgICAgICBsZXQgc2luZ2xlID0gZW50cnkuc3ViRW50cmllc1swXTtcclxuICAgICAgICAgICAgICAgICAgICBlbnRyeS5zdGFydFRpbWUgPSBzaW5nbGUuc3RhcnRUaW1lO1xyXG4gICAgICAgICAgICAgICAgICAgIGVudHJ5LmVuZFRpbWUgPSBzaW5nbGUuZW5kVGltZTtcclxuICAgICAgICAgICAgICAgICAgICBlbn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q2xhc3MoXCJjbGlja2FibGUtaWNvblwiKVxyXG4gICAgICAgICAgICAuc2V0SWNvbihgbHVjaWRlLXBsYXlgKVxyXG4gICAgICAgICAgICAuc2V0VG9vbHRpcChcIkNvbnRpbnVlXCIpXHJcbiAgICAgICAgICAgIC5vbkNsaWNrKGFzeW5jICgpID0+IHtcclxuICAgICAgICAgICAgICAgIHN0YXJ0U3ViRW50cnkoZW50cnksIG5ld1NlZ21lbnROYW1lQm94LmdldFZhbHVlKCkpO1xyXG4gICAgICAgICAgICAgICAgYXdhaXQgc2F2ZVRyYWNrZXIodHJhY2tlciwgdGhpcy5hcHAsIGZpbGUsIGdldFNlY3Rpb25JbmZvKCkpO1xyXG4gICAgICAgICAgICB9KTtcclxuICAgIH1cclxuICAgIGxldCBlZGl0QnV0dG9uID0gbmV3IEJ1dHRvbkNvbXBvbmVudChlbnRyeUJ1dHRvbnMpXHJcbiAgICAgICAgLnNldENsYXNzKFwiY2xpY2thYmxlLWljb25cIilcclxuICAgICAgICAuc2V0VG9vbHRpcChcIkVkaXRcIilcclxuICAgICAgICAuc2V0SWNvbihcImx1Y2lkZS1wZW5jaWxcIilcclxuICAgICAgICAub25DbGljayhhc3luYyAoKSA9PiB7XHJcbiAgICAgICAgICAgIGlmIChuYW1lUGFyLmhpZGRlbikge1xyXG4gICAgICAgICAgICAgICAgbmFtZVBhci5oaWRkZW4gPSBmYWxzZTtcclxuICAgICAgICAgICAgICAgIG5hbWVCb3guaW5wdXRFbC5oaWRkZW4gPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgZWRpdEJ1dHRvbi5zZXRJY29uKFwibHVjaWRlLXBlbmNpbFwiKTtcclxuICAgICAgICAgICAgICAgIGlmIChuYW1lQm94LmdldFZhbHVlKCkpIHtcclxuICAgICAgICAgICAgICAgICAgICBlbnRyeS5uYW1lID0gbmFtZUJveC5nZXRWYWx1ZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgIG5hbWVQYXIuc2V0VGV4dChlbnRyeS5uYW1lKTtcclxuICAgICAgICAgICAgICAgICAgICBhd2FpdCBzYXZlVHJhY2tlcih0cmFja2VyLCB0aGlzLmFwcCwgZmlsZSwgZ2V0U2VjdGlvbkluZm8oKSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBuYW1lUGFyLmhpZGRlbiA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICBuYW1lQm94LmlucHV0RWwuaGlkZGVuID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICBuYW1lQm94LnNldFZhbHVlKGVudHJ5Lm5hbWUpO1xyXG4gICAgICAgICAgICAgICAgZWRpdEJ1dHRvbi5zZXRJY29uKFwibHVjaWRlLWNoZWNrXCIpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSk7XHJcbiAgICBuZXcgQnV0dG9uQ29tcG9uZW50KGVudHJ5QnV0dG9ucylcclxuICAgICAgICAuc2V0Q2xhc3MoXCJjbGlja2FibGUtaWNvblwiKVxyXG4gICAgICAgIC5zZXRUb29sdGlwKFwiUmVtb3ZlXCIpXHJcbiAgICAgICAgLnNldEljb24oXCJsdWNpZGUtdHJhc2hcIilcclxuICAgICAgICAub25DbGljayhhc3luYyAoKSA9PiB7XHJcbiAgICAgICAgICAgIHJlbW92ZUVudHJ5KHRyYWNrZXIuZW50cmllcywgZW50cnkpO1xyXG4gICAgICAgICAgICBhd2FpdCBzYXZlVHJhY2tlcih0cmFja2VyLCB0aGlzLmFwcCwgZmlsZSwgZ2V0U2VjdGlvbkluZm8oKSk7XHJcbiAgICAgICAgfSk7XHJcblxyXG4gICAgaWYgKGVudHJ5LnN1YkVudHJpZXMpIHtcclxuICAgICAgICBmb3IgKGxldCBzdWIgb2YgZW50cnkuc3ViRW50cmllcylcclxuICAgICAgICAgICAgYWRkRWRpdGFibGVUYWJsZVJvdyh0cmFja2VyLCBzdWIsIHRhYmxlLCBuZXdTZWdtZW50TmFt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ugins/simple-time-tracker/main.js index 206dd2b..4c26e94 100644 --- a/test-vault/.obsidian/plugins/simple-time-tracker/main.js +++ b/test-vault/.obsidian/plugins/simple-time-tracker/main.js @@ -72,7 +72,8 @@ var import_obsidian3 = __toModule(require("obsidian")); // src/settings.ts var defaultSettings = { timestampFormat: "YY-MM-DD hh:mm:ss", - csvDelimiter: "," + csvDelimiter: ",", + fineGrainedDurations: true }; // src/settings-tab.ts @@ -103,6 +104,13 @@ var SimpleTimeTrackerSettingsTab = class extends import_obsidian.PluginSettingTa yield this.plugin.saveSettings(); })); }); + new import_obsidian.Setting(this.containerEl).setName("Fine-Grained Durations").setDesc("Whether durations should include days, months and years. If this is disabled, additional time units will be displayed as part of the hours.").addToggle((t) => { + t.setValue(this.plugin.settings.fineGrainedDurations); + t.onChange((v) => __async(this, null, function* () { + this.plugin.settings.fineGrainedDurations = v; + yield this.plugin.saveSettings(); + })); + }); this.containerEl.createEl("hr"); this.containerEl.createEl("p", { text: "If you like this plugin and want to support its development, you can do so through my website by clicking this fancy image!" }); this.containerEl.createEl("a", { href: "https://ellpeck.de/support" }).createEl("img", { @@ -168,13 +176,13 @@ function displayTracker(tracker, element, file, getSectionInfo, settings) { new import_obsidian2.ButtonComponent(buttons).setButtonText("Copy as table").onClick(() => navigator.clipboard.writeText(createMarkdownTable(tracker, settings))); new import_obsidian2.ButtonComponent(buttons).setButtonText("Copy as CSV").onClick(() => navigator.clipboard.writeText(createCsv(tracker, settings))); } - setCountdownValues(tracker, current, total, currentDiv); + setCountdownValues(tracker, current, total, currentDiv, settings); let intervalId = window.setInterval(() => { if (!element.isConnected) { window.clearInterval(intervalId); return; } - setCountdownValues(tracker, current, total, currentDiv); + setCountdownValues(tracker, current, total, currentDiv, settings); }, 1e3); } function startSubEntry(entry, name) { @@ -246,30 +254,36 @@ function getTotalDuration(entries) { ret += getDuration(entry); return ret; } -function setCountdownValues(tracker, current, total, currentDiv) { +function setCountdownValues(tracker, current, total, currentDiv, settings) { let running = getRunningEntry(tracker.entries); if (running && !running.endTime) { - current.setText(formatDuration(getDuration(running))); + current.setText(formatDuration(getDuration(running), settings)); currentDiv.hidden = false; } else { currentDiv.hidden = true; } - total.setText(formatDuration(getTotalDuration(tracker.entries))); + total.setText(formatDuration(getTotalDuration(tracker.entries), settings)); } function formatTimestamp(timestamp, settings) { return import_obsidian2.moment.unix(timestamp).format(settings.timestampFormat); } -function formatDuration(totalTime) { - let duration = import_obsidian2.moment.duration(totalTime); +function formatDuration(totalTime, settings) { 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 "; + let duration = import_obsidian2.moment.duration(totalTime); + let hours; + if (settings.fineGrainedDurations) { + if (duration.years() > 0) + ret += duration.years() + "y "; + if (duration.months() > 0) + ret += duration.months() + "M "; + if (duration.days() > 0) + ret += duration.days() + "d "; + hours = duration.hours(); + } else { + hours = Math.floor(duration.asHours()); + } + if (hours > 0) + ret += hours + "h "; if (duration.minutes() > 0) ret += duration.minutes() + "m "; ret += duration.seconds() + "s"; @@ -279,7 +293,7 @@ function createMarkdownTable(tracker, settings) { let table = [["Segment", "Start time", "End time", "Duration"]]; for (let entry of tracker.entries) table.push(...createTableSection(entry, settings)); - table.push(["**Total**", "", "", `**${formatDuration(getTotalDuration(tracker.entries))}**`]); + table.push(["**Total**", "", "", `**${formatDuration(getTotalDuration(tracker.entries), settings)}**`]); let ret = ""; let widths = Array.from(Array(4).keys()).map((i) => Math.max(...table.map((a) => a[i].length))); for (let r = 0; r < table.length; r++) { @@ -305,7 +319,7 @@ function createTableSection(entry, settings) { entry.name, entry.startTime ? formatTimestamp(entry.startTime, settings) : "", entry.endTime ? formatTimestamp(entry.endTime, settings) : "", - entry.endTime || entry.subEntries ? formatDuration(getDuration(entry)) : "" + entry.endTime || entry.subEntries ? formatDuration(getDuration(entry), settings) : "" ]]; if (entry.subEntries) { for (let sub of entry.subEntries) @@ -322,7 +336,7 @@ function addEditableTableRow(tracker, entry, table, newSegmentNameBox, running, nameBox.inputEl.hidden = true; row.createEl("td", { text: entry.startTime ? formatTimestamp(entry.startTime, settings) : "" }); row.createEl("td", { text: entry.endTime ? formatTimestamp(entry.endTime, settings) : "" }); - row.createEl("td", { text: entry.endTime || entry.subEntries ? formatDuration(getDuration(entry)) : "" }); + row.createEl("td", { text: entry.endTime || entry.subEntries ? formatDuration(getDuration(entry), settings) : "" }); let entryButtons = row.createEl("td"); if (!running) { new import_obsidian2.ButtonComponent(entryButtons).setClass("clickable-icon").setIcon(`lucide-play`).setTooltip("Continue").onClick(() => __async(this, null, function* () { @@ -388,5 +402,4 @@ var SimpleTimeTrackerPlugin = class extends import_obsidian3.Plugin { }); } }; -//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsic3JjL21haW4udHMiLCAic3JjL3NldHRpbmdzLnRzIiwgInNyYy9zZXR0aW5ncy10YWIudHMiLCAic3JjL3RyYWNrZXIudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImltcG9ydCB7IFBsdWdpbiB9IGZyb20gXCJvYnNpZGlhblwiO1xyXG5pbXBvcnQgeyBkZWZhdWx0U2V0dGluZ3MsIFNpbXBsZVRpbWVUcmFja2VyU2V0dGluZ3MgfSBmcm9tIFwiLi9zZXR0aW5nc1wiO1xyXG5pbXBvcnQgeyBTaW1wbGVUaW1lVHJhY2tlclNldHRpbmdzVGFiIH0gZnJvbSBcIi4vc2V0dGluZ3MtdGFiXCI7XHJcbmltcG9ydCB7IGRpc3BsYXlUcmFja2VyLCBsb2FkVHJhY2tlciwgVHJhY2tlciB9IGZyb20gXCIuL3RyYWNrZXJcIjtcclxuXHJcbmV4cG9ydCBkZWZhdWx0IGNsYXNzIFNpbXBsZVRpbWVUcmFja2VyUGx1Z2luIGV4dGVuZHMgUGx1Z2luIHtcclxuXHJcbiAgICBzZXR0aW5nczog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gICAgc3VwZXIoYXBwLCBwbHVnaW4pO1xyXG4gICAgICAgIHRoaXMucGx1Z2luID0gcGx1Z2luO1xyXG4gICAgfVxyXG5cclxuICAgIGRpc3BsYXkoKTogdm9pZCB7XHJcbiAgICAgICAgdGhpcy5jb250YWluZXJFbC5lbXB0eSgpO1xyXG4gICAgICAgIHRoaXMuY29udGFpbmVyRWwuY3JlYXRlRWwoXCJoMlwiLCB7dGV4dDogXCJTdXBlciBTaW1wbGUgVGltZSBUcmFja2VyIFNldHRpbmdzXCJ9KTtcclxuXHJcbiAgICAgICAgbmV3IFNldHRpbmcodGhpcy5jb250YWluZXJFbClcclxuICAgICAgICAgICAgLnNldE5hbWUoXCJUaW1lc3RhbXAgRGlzcGxheSBGb3JtYXRcIilcclxuICAgICAgICAgICAgLnNldERlc2MoY3JlYXRlRnJhZ21lbnQoZiA9PiB7XHJcbiAgICAgICAgICAgICAgICBmLmNyZWF0ZVNwYW4oe3RleHQ6IFwiVGhlIHdheSB0aGF0IHRpbWVzdGFtcHMgaW4gdGltZSB0cmFja2VyIHRhYmxlcyBzaG91bGQgYmUgZGlzcGxheWVkLiBVc2VzIFwifSk7XHJcbiAgICAgICAgICAgICAgICBmLmNyZWF0ZUVsKFwiYVwiLCB7dGV4dDogXCJtb21lbnQuanNcIiwgaHJlZjogXCJodHRwczovL21vbWVudGpzLmNvbS9kb2NzLyMvcGFyc2luZy9zdHJpbmctZm9ybWF0L1wifSk7XHJcbiAgICAgICAgICAgICAgICBmLmNyZWF0ZVNwYW4oe3RleHQ6IFwiIHN5bnRheC5cIn0pO1xyXG4gICAgICAgICAgICB9KSlcclxuICAgICAgICAgICAgLmFkZFRleHQodCA9PiB7XHJcbiAgICAgICAgICAgICAgICB0LnNldFZhbHVlKFN0cmluZyh0aGlzLnBsdWdpbi5zZXR0aW5ncy50aW1lc3RhbXBGb3JtYXQpKTtcclxuICAgICAgICAgICAgICAgIHQub25DaGFuZ2UoYXN5bmMgdiA9PiB7XHJcbiAgICA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4KCksIGVuZFRpbWU6IG51bGwsIHN1YkVudHJpZXM6IG51bGx9O1xyXG4gICAgdHJhY2tlci5lbnRyaWVzLnB1c2goZW50cnkpO1xyXG59XHJcblxyXG5mdW5jdGlvbiBlbmRSdW5uaW5nRW50cnkodHJhY2tlcjogVHJhY2tlcik6IHZvaWQge1xyXG4gICAgbGV0IGVudHJ5ID0gZ2V0UnVubmluZ0VudHJ5KHRyYWNrZXIuZW50cmllcyk7XHJcbiAgICBlbnRyeS5lbmRUaW1lID0gbW9tZW50KCkudW5peCgpO1xyXG59XHJcblxyXG5mdW5jdGlvbiByZW1vdmVFbnRyeShlbnRyaWVzOiBFbnRyeVtdLCB0b1JlbW92ZTogRW50cnkpOiBib29sZWFuIHtcclxuICAgIGlmIChlbnRyaWVzLmNvbnRhaW5zKHRvUmVtb3ZlKSkge1xyXG4gICAgICAgIGVudHJpZXMucmVtb3ZlKHRvUmVtb3ZlKTtcclxuICAgICAgICByZXR1cm4gdHJ1ZTtcclxuICAgIH0gZWxzZSB7XHJcbiAgICAgICAgZm9yIChsZXQgZW50cnkgb2YgZW50cmllcykge1xyXG4gICAgICAgICAgICBpZiAoZW50cnkuc3ViRW50cmllcyAmJiByZW1vdmVFbnRyeShlbnRyeS5zdWJFbnRyaWVzLCB0b1JlbW92ZSkpIHtcclxuICAgICAgICAgICAgICAgIC8vIGlmIHdlIG9ubHkgaGF2ZSBvbmUgc3ViIGVudHJ5IHJlbWFpbmluZywgd2UgY2FuIG1lcmdlIGJhY2sgaW50byBvdXIgbWFpbiBlbnRyeVxyXG4gICAgICAgICAgICAgICAgaWYgKGVudHJ5LnN1YkVudHJpZXMubGVuZ3RoID09IDEpIHtcclxuICAgICAgICAgICAgICAgICAgICBsZXQgc2luZ2xlID0gZW50cnkuc3ViRW50cmllc1swXTtcclxuICAgICAgICAgICAgICAgICAgICBlbnRyeS5zdGFydFRpbWUgPSBzaW5nbGUuc3RhcnRUaW1lO1xyXG4gICAgICAgICAgICAgICAgICAgIG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mFja2VyLCB0aGlzLmFwcCwgZmlsZSwgZ2V0U2VjdGlvbkluZm8oKSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgfVxyXG4gICAgbGV0IGVkaXRCdXR0b24gPSBuZXcgQnV0dG9uQ29tcG9uZW50KGVudHJ5QnV0dG9ucylcclxuICAgICAgICAuc2V0Q2xhc3MoXCJjbGlja2FibGUtaWNvblwiKVxyXG4gICAgICAgIC5zZXRUb29sdGlwKFwiRWRpdFwiKVxyXG4gICAgICAgIC5zZXRJY29uKFwibHVjaWRlLXBlbmNpbFwiKVxyXG4gICAgICAgIC5vbkNsaWNrKGFzeW5jICgpID0+IHtcclxuICAgICAgICAgICAgaWYgKG5hbWVQYXIuaGlkZGVuKSB7XHJcbiAgICAgICAgICAgICAgICBuYW1lUGFyLmhpZGRlbiA9IGZhbHNlO1xyXG4gICAgICAgICAgICAgICAgbmFtZUJveC5pbnB1dEVsLmhpZGRlbiA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICBlZGl0QnV0dG9uLnNldEljb24oXCJsdWNpZGUtcGVuY2lsXCIpO1xyXG4gICAgICAgICAgICAgICAgaWYgKG5hbWVCb3guZ2V0VmFsdWUoKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIGVudHJ5Lm5hbWUgPSBuYW1lQm94LmdldFZhbHVlKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgbmFtZVBhci5zZXRUZXh0KGVudHJ5Lm5hbWUpO1xyXG4gICAgICAgICAgICAgICAgICAgIGF3YWl0IHNhdmVUcmFja2VyKHRyYWNrZXIsIHRoaXMuYXBwLCBmaWxlLCBnZXRTZWN0aW9uSW5mbygpKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIG5hbWVQYXIuaGlkZGVuID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgIG5hbWVCb3guaW5wdXRFbC5oaWRkZW4gPSBmYWxzZTtcclxuICAg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tcclxuXHJcbiAgICAgICAgbmV3IFNldHRpbmcodGhpcy5jb250YWluZXJFbClcclxuICAgICAgICAgICAgLnNldE5hbWUoXCJUaW1lc3RhbXAgRGlzcGxheSBGb3JtYXRcIilcclxuICAgICAgICAgICAgLnNldERlc2MoY3JlYXRlRnJhZ21lbnQoZiA9PiB7XHJcbiAgICAgICAgICAgICAgICBmLmNyZWF0ZVNwYW4oeyB0ZXh0OiBcIlRoZSB3YXkgdGhhdCB0aW1lc3RhbXBzIGluIHRpbWUgdHJhY2tlciB0YWJsZXMgc2hvdWxkIGJlIGRpc3BsYXllZC4gVXNlcyBcIiB9KTtcclxuICAgICAgICAgICAgICAgIGYuY3JlYXRlRWwoXCJhXCIsIHsgdGV4dDogXCJtb21lbnQuanNcIiwgaHJlZjogXCJodHRwczovL21vbWVudGpzLmNvbS9kb2NzLyMvcGFyc2luZy9zdHJpbmctZm9ybWF0L1wiIH0pO1xyXG4gICAgICAgICAgICAgICAgZi5jcmVhdGVTcGFuKHsgdGV4dDogXCIgc3ludGF4LlwiIH0pO1xyXG4gICAgICAgICAgICB9KSlcclxuICAgICAgICAgICAgLmFkZFRleHQodCA9PiB7XHJcbiAgICAgICAgICAgICAgICB0LnNldFZhbHVlKFN0cmluZyh0aGlzLnBsdWdpbi5zZXR0aW5ncy50aW1lc3RhbXBGb3JtYXQpKTtcclxuICAgICAgICAgICAgICAgIHQub25DaGFuZ2UoYXN5bmMgdiA9PiB7XHJcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5wbHVnaW4uc2V0dGluZ3MudGltZXN0YW1wRm9ybWF0ID0gdi5sZW5ndGggPyB2IDogZGVmYXVsdFNldHRpbmdzLnRpbWVzdGFtcEZvcm1hdDtcclxuICAgICAgICAgICAgICAgICAgICBhd2FpdCB0aGlzLnBsdWdpbi5zYXZlU2V0dGluZ3MoKTtcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9KTtcclxuXHJcbiAgICAgICAgbmV3IFNldHR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ShlbnRyaWVzOiBFbnRyeVtdLCB0b1JlbW92ZTogRW50cnkpOiBib29sZWFuIHtcclxuICAgIGlmIChlbnRyaWVzLmNvbnRhaW5zKHRvUmVtb3ZlKSkge1xyXG4gICAgICAgIGVudHJpZXMucmVtb3ZlKHRvUmVtb3ZlKTtcclxuICAgICAgICByZXR1cm4gdHJ1ZTtcclxuICAgIH0gZWxzZSB7XHJcbiAgICAgICAgZm9yIChsZXQgZW50cnkgb2YgZW50cmllcykge1xyXG4gICAgICAgICAgICBpZiAoZW50cnkuc3ViRW50cmllcyAmJiByZW1vdmVFbnRyeShlbnRyeS5zdWJFbnRyaWVzLCB0b1JlbW92ZSkpIHtcclxuICAgICAgICAgICAgICAgIC8vIGlmIHdlIG9ubHkgaGF2ZSBvbmUgc3ViIGVudHJ5IHJlbWFpbmluZywgd2UgY2FuIG1lcmdlIGJhY2sgaW50byBvdXIgbWFpbiBlbnRyeVxyXG4gICAgICAgICAgICAgICAgaWYgKGVudHJ5LnN1YkVudHJpZXMubGVuZ3RoID09IDEpIHtcclxuICAgICAgICAgICAgICAgICAgICBsZXQgc2luZ2xlID0gZW50cnkuc3ViRW50cmllc1swXTtcclxuICAgICAgICAgICAgICAgICAgICBlbnRyeS5zdGFydFRpbWUgPSBzaW5nbGUuc3RhcnRUaW1lO1xyXG4gICAgICAgICAgICAgICAgICAgIGVudHJ5LmVuZFRpbWUgPSBzaW5nbGUuZW5kVGltZTtcclxuICAgICAgICAgICAgICAgICAgICBlbnRyeS5zdWJFbnRyaWVzID0gbnVsbDtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHJldHVybiB0cnVlO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG4gICAgfVxyXG4gICAgcmV0dXJuIGZhbHNlO1xyXG59XHJcblxyXG5mdW5jdGlvbiBpc1J1bm5pbmcodHJhY2tlcjogVHJhY2tlcik6IGJvb2xlYW4ge1xyXG4gICAgcmV0dXJuICEhZ2V0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HJ5LmVuZFRpbWUsIHNldHRpbmdzKSA6IFwiXCIgfSk7XHJcbiAgICByb3cuY3JlYXRlRWwoXCJ0ZFwiLCB7IHRleHQ6IGVudHJ5LmVuZFRpbWUgfHwgZW50cnkuc3ViRW50cmllcyA/IGZvcm1hdER1cmF0aW9uKGdldER1cmF0aW9uKGVudHJ5KSkgOiBcIlwiIH0pO1xyXG5cclxuICAgIGxldCBlbnRyeUJ1dHRvbnMgPSByb3cuY3JlYXRlRWwoXCJ0ZFwiKTtcclxuICAgIGlmICghcnVubmluZykge1xyXG4gICAgICAgIG5ldyBCdXR0b25Db21wb25lbnQoZW50cnlCdXR0b25zKVxyXG4gICAgICAgICAgICAuc2V0Q2xhc3MoXCJjbGlja2FibGUtaWNvblwiKVxyXG4gICAgICAgICAgICAuc2V0SWNvbihgbHVjaWRlLXBsYXlgKVxyXG4gICAgICAgICAgICAuc2V0VG9vbHRpcChcIkNvbnRpbnVlXCIpXHJcbiAgICAgICAgICAgIC5vbkNsaWNrKGFzeW5jICgpID0+IHtcclxuICAgICAgICAgICAgICAgIHN0YXJ0U3ViRW50cnkoZW50cnksIG5ld1NlZ21lbnROYW1lQm94LmdldFZhbHVlKCkpO1xyXG4gICAgICAgICAgICAgICAgYXdhaXQgc2F2ZVRyYWNrZXIodHJhY2tlciwgdGhpcy5hcHAsIGdldFNlY3Rpb25JbmZvKCkpO1xyXG4gICAgICAgICAgICB9KTtcclxuICAgIH1cclxuICAgIGxldCBlZGl0QnV0dG9uID0gbmV3IEJ1dHRvbkNvbXBvbmVudChlbnRyeUJ1dHRvbnMpXHJcbiAgICAgICAgLnNldENsYXNzKFwiY2xpY2thYmxlLWljb25cIilcclxuICAgICAgICAuc2V0VG9vbHRpcChcIkVkaXRcIilcclxuICAgICAgICAuc2V0SWNvbihcImx1Y2lkZS1wZW5jaWxcIilcclxuICAgICAgICAub25DbGljayhhc3luYyAoKSA9PiB7XHJcbiAgICAgICAgICAgIGlmIChuYW1lUGFyLmhpZGRlbikge1xyXG4gICAgICAgICAgICAgICAgbmFtZVBhci5oaWRkZW4gPSBmYWxzZTtcclxuICAgICAgICAgICAgICAgIG5hbWVCb3guaW5wdXRFbC5oaWRkZW4gPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgZWRpdEJ1dHRvbi5zZXRJY29uKFwibHVjaWRlLXBlbmNpbFwiKTtcclxuICAgICAgICAgICAgICAgIGlmIChuYW1lQm94LmdldFZhbHVlKCkpIHtcclxuICAgICAgICAgICAgICAgICAgICBlbnRyeS5uYW1lID0gbmFtZUJveC5nZXRWYWx1ZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgIG5hbWVQYXIuc2V0VGV4dChlbnRyeS5uYW1lKTtcclxuICAgICAgICAgICAgICAgICAgICBhd2FpdCBzYXZlVHJhY2tlcih0cmFja2VyLCB0aGlzLmFwcCwgZ2V0U2VjdGlvbkluZm8oKSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBuYW1lUGFyLmhpZGRlbiA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICBuYW1lQm94LmlucHV0RWwuaGlkZGVuID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICBuYW1lQm94LnNldFZhbHVlKGVudHJ5Lm5hbWUpO1xyXG4gICAgICAgICAgICAgICAgZWRpdEJ1dHRvbi5zZXRJY29uKFwibHVjaWRlLWNoZWNrXCIpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSk7XHJcbiAgICBuZXcgQnV0dG9uQ29tcG9uZW50KGVudHJ5QnV0dG9ucylcclxuICAgICAgICAuc2V0Q2xhc3MoXCJjbGlja2FibGUtaWNvblwiKVxyXG4gICAgICAgIC5zZXRUb29sdGlwKFwiUmVtb3ZlXCIpXHJcbiAgICAgICAgLnNldEljb24oXCJsdWNpZGUtdHJhc2hcIilcclxuICAgICAgICAub25DbGljayhhc3luYyAoKSA9PiB7XHJcbiAgICAg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ZXN0IHVudG91Y2hlZFxyXG4gICAgY29udGVudCA9IGAke3ByZXZ9XFxuJHtKU09OLnN0cmluZ2lmeSh0cmFja2VyKX1cXG4ke25leHR9YDtcclxuXHJcbiAgICBhd2FpdCBhcHAudmF1bHQubW9kaWZ5KGZpbGUsIGNvbnRlbnQpO1xyXG59XHJcblxyXG5leHBvcnQgZnVuY3Rpb24gbG9hZFRyYWNrZXIoanNvbjogc3RyaW5nKTogVHJhY2tlciB7XHJcbiAgICBpZiAoanNvbikge1xyXG4gICAgICAgIHRyeSB7XHJcbiAgICAgICAgICAgIHJldHVybiBKU09OLnBhcnNlKGpzb24pO1xyXG4gICAgICAgIH0gY2F0Y2ggKGUpIHtcclxuICAgICAgICAgICAgY29uc29sZS5sb2coYEZhaWxlZCB0byBwYXJzZSBUcmFja2VyIGZyb20gJHtqc29ufWApO1xyXG4gICAgICAgIH1cclxuICAgIH1cclxuICAgIHJldHVybiB7ZW50cmllczogW119O1xyXG59XHJcblxyXG5leHBvcnQgZnVuY3Rpb24gZGlzcGxheVRyYWNrZXIodHJhY2tlcjogVHJhY2tlciwgZWxlbWVudDogSFRNTEVsZW1lbnQsIGZpbGU6IHN0cmluZywgZ2V0U2VjdGlvbkluZm86ICgpID0+IE1hcmtkb3duU2VjdGlvbkluZm9ybWF0aW9uLCBzZXR0aW5nczogU2ltcGxlVGltZVRyYWNrZXJTZXR0aW5ncyk6IHZvaWQge1xyXG4gICAgLy8gYWRkIHN0YXJ0L3N0b3AgY29udHJvbHNcclxuICAgIGxldCBydW5uaW5nID0gaXNSdW5uaW5nKHRyYWNrZXIpO1xyXG4gICAgbGV0IGJ0biA9IG5ldyBCdXR0b25Db21wb25lbnQoZWxlbWVudClcclxuICAgICAgICAuc2V0Q2xhc3MoXCJjbGlja2FibGUtaWNvblwiKVxyXG4gICAgICAgIC5zZXRJY29uKGBsdWNpZGUtJHtydW5uaW5nID8gXCJzdG9wXCIgOiBcInBsYXlcIn0tY2lyY2xlYClcclxuICAgICAgICAuc2V0VG9vbHRpcChydW5uaW5nID8gXCJFbmRcIiA6IFwiU3RhcnRcIilcclxuICAgICAgICAub25DbGljayhhc3luYyAoKSA9PiB7XHJcbiAgICAgICAgICAgIGlmIChydW5uaW5nKSB7XHJcbiAgICAgICAgICAgICAgICBlbmRSdW5uaW5nRW50cnkodHJhY2tlcik7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBzdGFydE5ld0VudHJ5KHRyYWNrZXIsIG5ld1NlZ21lbnROYW1lQm94LmdldFZhbHVlKCkpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGF3YWl0IHNhdmVUcmFja2VyKHRyYWNrZXIsIHRoaXMuYXBwLCBmaWxlLCBnZXRTZWN0aW9uSW5mbygpKTtcclxuICAgICAgICB9KTtcclxuICAgIGJ0bi5idXR0b25FbC5hZGRDbGFzcyhcInNpbXBsZS10aW1lLXRyYWNrZXItYnRuXCIpO1xyXG4gICAgbGV0IG5ld1NlZ21lbnROYW1lQm94ID0gbmV3IFRleHRDb21wb25lbnQoZWxlbWVudClcclxuICAgICAgICAuc2V0UGxhY2Vob2xkZXIoXCJTZWdtZW50IG5hbWVcIilcclxuICAgICAgICAuc2V0RGlzYWJsZWQocnVubmluZyk7XHJcbiAgICBuZXdTZWdtZW50TmFtZUJveC5pbnB1dEVsLmFkZENsYXNzKFwic2ltcGxlLXRpbWUtdHJhY2tlci10eHRcIik7XHJcblxyXG4gICAgLy8gYWRkIHRpbWVyc1xyXG4gICAgbGV0IHRpbWVyID0gZWxlbWVudC5jcmVhdGVEaXYoe2NsczogXCJzaW1wbGUtdGltZS10cmFja2VyLXRpbWVyc1wifSk7XHJcbiAgICBsZXQgY3VycmVudERpdiA9IHRpbWVyLmNyZWF0ZUVsKFwiZGl2XCIsIHtjbHM6IFwic2ltcGxlLXRpbWUtdHJhY2tlci10aW1lclwifSk7XHJcbiAgICBsZXQgY3VycmVudCA9IGN1cnJlbnREaXYuY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udHJ5LnN1YkVudHJpZXMubGVuZ3RoID09IDEpIHtcclxuICAgICAgICAgICAgICAgICAgICBsZXQgc2luZ2xlID0gZW50cnkuc3ViRW50cmllc1swXTtcclxuICAgICAgICAgICAgICAgICAgICBlbnRyeS5zdGFydFRpbWUgPSBzaW5nbGUuc3RhcnRUaW1lO1xyXG4gICAgICAgICAgICAgICAgICAgIGVudHJ5LmVuZFRpbWUgPSBzaW5nbGUuZW5kVGltZTtcclxuICAgICAgICAgICAgICAgICAgICBlbnRyeS5zdWJFbnRyaWVzID0gbnVsbDtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHJldHVybiB0cnVlO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG4gICAgfVxyXG4gICAgcmV0dXJuIGZhbHNlO1xyXG59XHJcblxyXG5mdW5jdGlvbiBpc1J1bm5pbmcodHJhY2tlcjogVHJhY2tlcik6IGJvb2xlYW4ge1xyXG4gICAgcmV0dXJuICEhZ2V0UnVubmluZ0VudHJ5KHRyYWNrZXIuZW50cmllcyk7XHJcbn1cclxuXHJcbmZ1bmN0aW9uIGdldFJ1bm5pbmdFbnRyeShlbnRyaWVzOiBFbnRyeVtdKTogRW50cnkge1xyXG4gICAgZm9yIChsZXQgZW50cnkgb2YgZW50cmllcykge1xyXG4gICAgICAgIC8vIGlmIHRoaXMgZW50cnkgaGFzIHN1YiBlbnRyaWVzLCBjaGVjayBpZiBvbmUgb2YgdGhlbSBpcyBydW5uaW5nXHJcbiAgICAgICAgaWYgKGVudHJ5LnN1YkVudHJpZXMpIHtcclxuICAgICAgICAgICAgbGV0IHJ1bm5pbmcgPSBnZXRSdW5uaW5nRW50cnkoZW50cnkuc3ViRW50cmllcyk7XHJcbiAgICAgICAgICAgIGlmIChydW5uaW5nKVxyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHJ1bm5pbmc7XHJcbiAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgLy8gaWYgdG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FwiO1xyXG4gICAgICAgIGlmIChkdXJhdGlvbi5tb250aHMoKSA+IDApXHJcbiAgICAgICAgICAgIHJldCArPSBkdXJhdGlvbi5tb250aHMoKSArIFwiTSBcIjtcclxuICAgICAgICBpZiAoZHVyYXRpb24uZGF5cygpID4gMClcclxuICAgICAgICAgICAgcmV0ICs9IGR1cmF0aW9uLmRheXMoKSArIFwiZCBcIjtcclxuICAgICAgICBob3VycyA9IGR1cmF0aW9uLmhvdXJzKCk7XHJcbiAgICB9IGVsc2Uge1xyXG4gICAgICAgIGhvdXJzID0gTWF0aC5mbG9vcihkdXJhdGlvbi5hc0hvdXJzKCkpO1xyXG4gICAgfVxyXG4gICAgaWYgKGhvdXJzID4gMClcclxuICAgICAgICByZXQgKz0gaG91cnMgKyBcImggXCI7XHJcbiAgICBpZiAoZHVyYXRpb24ubWludXRlcygpID4gMClcclxuICAgICAgICByZXQgKz0gZHVyYXRpb24ubWludXRlcygpICsgXCJtIFwiO1xyXG4gICAgcmV0ICs9IGR1cmF0aW9uLnNlY29uZHMoKSArIFwic1wiO1xyXG4gICAgcmV0dXJuIHJldDtcclxufVxyXG5cclxuZnVuY3Rpb24gY3JlYXRlTWFya2Rvd25UYWJsZSh0cmFja2VyOiBUcmFja2VyLCBzZXR0aW5nczogU2ltcGxlVGltZVRyYWNrZXJTZXR0aW5ncyk6IHN0cmluZyB7XHJcbiAgICBsZXQgdGFibGUgPSBbW1wiU2VnbWVudFwiLCBcIlN0YXJ0IHRpbWVcIiwgXCJFbmQgdGltZVwiLCBcIkR1cmF0aW9uXCJdXTtcclxuICAgIGZvciAobGV0IGVudHJ5IG9mIHRyYWNrZXIuZW50cmllcylcclxuICAgICAgICB0YWJsZS5wdXNoKC4uLmNyZWF0ZVRhYmxlU2VjdGlvbihlbnRyeSwgc2V0dGluZ3MpKTtcclxuICAgIHRhYmxlLnB1c2goW1wiKipUb3RhbCoqXCIsIFwiXCIsIFwiXCIsIGAqKiR7Zm9ybWF0RHVyYXRpb24o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gfHwgZW50cnkuc3ViRW50cmllcyA/IGZvcm1hdER1cmF0aW9uKGdldER1cmF0aW9uKGVudHJ5KSwgc2V0dGluZ3MpIDogXCJcIn0pO1xyXG5cclxuICAgIGxldCBlbnRyeUJ1dHRvbnMgPSByb3cuY3JlYXRlRWwoXCJ0ZFwiKTtcclxuICAgIGlmICghcnVubmluZykge1xyXG4gICAgICAgIG5ldyBCdXR0b25Db21wb25lbnQoZW50cnlCdXR0b25zKVxyXG4gICAgICAgICAgICAuc2V0Q2xhc3MoXCJjbGlja2FibGUtaWNvblwiKVxyXG4gICAgICAgICAgICAuc2V0SWNvbihgbHVjaWRlLXBsYXlgKVxyXG4gICAgICAgICAgICAuc2V0VG9vbHRpcChcIkNvbnRpbnVlXCIpXHJcbiAgICAgICAgICAgIC5vbkNsaWNrKGFzeW5jICgpID0+IHtcclxuICAgICAgICAgICAgICAgIHN0YXJ0U3ViRW50cnkoZW50cnksIG5ld1NlZ21lbnROYW1lQm94LmdldFZhbHVlKCkpO1xyXG4gICAgICAgICAgICAgICAgYXdhaXQgc2F2ZVRyYWNrZXIodHJhY2tlciwgdGhpcy5hcHAsIGZpbGUsIGdldFNlY3Rpb25JbmZvKCkpO1xyXG4gICAgICAgICAgICB9KTtcclxuICAgIH1cclxuICAgIGxldCBlZGl0QnV0dG9uID0gbmV3IEJ1dHRvbkNvbXBvbmVudChlbnRyeUJ1dHRvbnMpXHJcbiAgICAgICAgLnNldENsYXNzKFwiY2xpY2thYmxlLWljb25cIilcclxuICAgICAgICAuc2V0VG9vbHRpcChcIkVkaXRcIilcclxuICAgICAgICAuc2V0SWNvbihcImx1Y2lkZS1wZW5jaWxcIilcclxuICAgICAgICAub25DbGljayhhc3luYyAoKSA9PiB7XHJcbiAgICAgICAgICAgIGlmIChuYW1lUGFyLmhpZGRlbikge1xyXG4gICAgICAgICAgICAgICAgbmFtZVBhci5oaWRkZW4gPSBmYWxzZTtcclxuICAgICAgICAgICAgICAgIG5hbWVCb3guaW5wdXRFbC5oaWRkZW4gPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgZWRpdEJ1dHRvbi5zZXRJY29uKFwibHVjaWRlLXBlbmNpbFwiKTtcclxuICAgICAgICAgICAgICAgIGlmIChuYW1lQm94LmdldFZhbHVlKCkpIHtcclxuICAgICAgICAgICAgICAgICAgICBlbnRyeS5uYW1lID0gbmFtZUJveC5nZXRWYWx1ZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgIG5hbWVQYXIuc2V0VGV4dChlbnRyeS5uYW1lKTtcclxuICAgICAgICAgICAgICAgICAgICBhd2FpdCBzYXZlVHJhY2tlcih0cmFja2VyLCB0aGlzLmFwcCwgZmlsZSwgZ2V0U2VjdGlvbkluZm8oKSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBuYW1lUGFyLmhpZGRlbiA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICBuYW1lQm94LmlucHV0RWwuaGlkZGVuID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICBuYW1lQm94LnNldFZhbHVlKGVudHJ5Lm5hbWUpO1xyXG4gICAgICAgICAgICAgICAgZWRpdEJ1dHRvbi5zZXRJY29uKFwibHVjaWRlLWNoZWNrXCIpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSk7XHJcbiAgICBuZXcgQnV0dG9uQ29tcG9uZW50KGVudHJ5QnV0dG9ucylcclxuICAgICAgICAuc2V0Q2xhc3MoXCJjbGlja2FibGUtaWNvblwiKVxyXG4gICAgICAgIC5zZXRUb29sdGlwKFwiUmVtb3ZlXCIpXHJcbiAgICAgICAgLnNldEljb24oXCJsdWNpZGUtdHJhc2hcIilcclxuICAgICAgICAub25DbGljayhhc3luYyAoKSA9PiB7XHJcbiAgICAgICAgICAgIHJlbW92ZUVudHJ5KHRyYWNrZXIuZW50cmllcywgZW50cnkpO1xyXG4gICAgICAgICAgICBhd2FpdCBzYXZlV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BO0FBQUEsRUFLekIsZUFBOEI7QUFBQTtBQUNoQyxXQUFLLFdBQVcsT0FBTyxPQUFPLElBQUksaUJBQWlCLE1BQU0sS0FBSztBQUFBO0FBQUE7QUFBQSxFQUc1RCxlQUE4QjtBQUFBO0FBQ2hDLFlBQU0sS0FBSyxTQUFTLEtBQUs7QUFBQTtBQUFBO0FBQUE7IiwKICAibmFtZXMiOiBbXQp9Cg== diff --git a/test-vault/duration_accumulation_test.md b/test-vault/duration_accumulation_test.md index 79e8c76..fec3750 100644 --- a/test-vault/duration_accumulation_test.md +++ b/test-vault/duration_accumulation_test.md @@ -2,10 +2,5 @@ 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} -]} +{"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},{"name":"Segment 5","startTime":1684858616,"endTime":1684858619,"subEntries":null}]} ```