git-watchtower 1.6.1 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/git-watchtower.js +49 -2
- package/package.json +6 -1
- package/sounds/README.md +34 -0
- package/src/casino/index.js +721 -0
- package/src/casino/sounds.js +245 -0
- package/src/cli/args.js +239 -0
- package/src/config/loader.js +329 -0
- package/src/config/schema.js +305 -0
- package/src/git/branch.js +428 -0
- package/src/git/commands.js +416 -0
- package/src/git/pr.js +111 -0
- package/src/git/remote.js +127 -0
- package/src/index.js +179 -0
- package/src/polling/engine.js +157 -0
- package/src/server/process.js +329 -0
- package/src/server/static.js +95 -0
- package/src/state/store.js +527 -0
- package/src/telemetry/analytics.js +142 -0
- package/src/telemetry/config.js +123 -0
- package/src/telemetry/index.js +93 -0
- package/src/ui/actions.js +425 -0
- package/src/ui/ansi.js +498 -0
- package/src/ui/keybindings.js +198 -0
- package/src/ui/renderer.js +1326 -0
- package/src/utils/async.js +219 -0
- package/src/utils/browser.js +40 -0
- package/src/utils/errors.js +490 -0
- package/src/utils/gitignore.js +174 -0
- package/src/utils/sound.js +33 -0
- package/src/utils/time.js +27 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Time formatting utilities
|
|
3
|
+
* @module utils/time
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Format a date as a human-readable relative time string.
|
|
8
|
+
* @param {Date} date - The date to format
|
|
9
|
+
* @returns {string} Relative time string (e.g., "just now", "5m ago", "2 days ago")
|
|
10
|
+
*/
|
|
11
|
+
function formatTimeAgo(date) {
|
|
12
|
+
const now = new Date();
|
|
13
|
+
const diffMs = now.getTime() - date.getTime();
|
|
14
|
+
const diffSec = Math.floor(diffMs / 1000);
|
|
15
|
+
const diffMin = Math.floor(diffSec / 60);
|
|
16
|
+
const diffHr = Math.floor(diffMin / 60);
|
|
17
|
+
const diffDay = Math.floor(diffHr / 24);
|
|
18
|
+
|
|
19
|
+
if (diffSec < 10) return 'just now';
|
|
20
|
+
if (diffSec < 60) return `${diffSec}s ago`;
|
|
21
|
+
if (diffMin < 60) return `${diffMin}m ago`;
|
|
22
|
+
if (diffHr < 24) return `${diffHr}h ago`;
|
|
23
|
+
if (diffDay === 1) return '1 day ago';
|
|
24
|
+
return `${diffDay} days ago`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
module.exports = { formatTimeAgo };
|