From bb20bb29c51e815a74079e0343403c9f8ac5e579 Mon Sep 17 00:00:00 2001 From: andrepimenta Date: Mon, 7 Jul 2025 22:39:39 +0100 Subject: [PATCH] Display unix time when message is Claude AI usage limit reached --- src/ui.ts | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/ui.ts b/src/ui.ts index 1c3e562..e2ced68 100644 --- a/src/ui.ts +++ b/src/ui.ts @@ -1666,7 +1666,31 @@ const html = ` case 'output': if (message.data.trim()) { - addMessage(parseSimpleMarkdown(message.data), 'claude'); + let displayData = message.data; + + // Check if this is a usage limit message with Unix timestamp + const usageLimitMatch = displayData.match(/Claude AI usage limit reached\\|(\\d+)/); + if (usageLimitMatch) { + const timestamp = parseInt(usageLimitMatch[1]); + const date = new Date(timestamp * 1000); + const readableDate = date.toLocaleString( + undefined, + { + weekday: 'short', + month: 'short', + day: 'numeric', + hour: 'numeric', + minute: '2-digit', + second: '2-digit', + hour12: true, + timeZoneName: 'short', + year: 'numeric' + } + ); + displayData = displayData.replace(usageLimitMatch[0], \`Claude AI usage limit reached: \${readableDate}\`); + } + + addMessage(parseSimpleMarkdown(displayData), 'claude'); } updateStatusWithTotals(); break;