diff --git a/CHANGELOG.md b/CHANGELOG.md index cf68b8f..9b74af8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 0.3.5 — 2026-09-01 + +- Interpret the ChatGPT desktop version date segment (`YY.MDD`) for the + launch-button tooltip, with the local package/update date as a fallback for + versions that do not match the observed format. + ## 0.3.4 — 2026-09-01 - Derive the ChatGPT launch-button date dynamically from the installed diff --git a/README.md b/README.md index 1262c76..e9ae01e 100644 --- a/README.md +++ b/README.md @@ -66,9 +66,10 @@ native expandable section, which opens automatically after recent activity. - Launches an installed ChatGPT desktop app or Codex CLI directly, with native installation guidance when either is missing. Web shortcuts cover ChatGPT, - Codex Cloud and ChatGPT Analytics. The ChatGPT launch tooltip derives its - displayed date from the installed executable's local package/update timestamp; - this is not an upstream publication-date guarantee. + Codex Cloud and ChatGPT Analytics. The ChatGPT launch tooltip interprets the + observed date segment in the desktop version (`YY.MDD`) and falls back to the + installed executable's local package/update timestamp when that format is + unavailable; neither is an upstream publication-date guarantee. - Shows `5h` automatically only when an active API limit exposes that window; an accompanying `7d` panel block can be hidden in settings while unnamed internal buckets stay hidden. @@ -94,7 +95,7 @@ cd cinnamon-chatgpt-usage Then open **System Settings → Applets** and add **ChatGPT Usage** to a panel. Requirements: Cinnamon 5.8+, Python 3 and a current [Codex CLI](https://learn.chatgpt.com/docs/codex/cli#getting-started) signed in -with ChatGPT. Version 0.3.4 is tested on Cinnamon 6.6.9 with Codex CLI 0.152.0. +with ChatGPT. Version 0.3.5 is tested on Cinnamon 6.6.9 with Codex CLI 0.152.0. Run `./install.sh` again after updates. `./uninstall.sh` removes the applet while retaining its settings. diff --git a/applet.js b/applet.js index d8ab40e..54d051b 100644 --- a/applet.js +++ b/applet.js @@ -1046,6 +1046,7 @@ class ChatGptUsageApplet extends Applet.Applet { const codexPath = this._resolveCodexPath(); const codexCommand = this._codexTerminalCommand(codexPath); const chatGptVersion = this._chatGptAppVersion(chatGptApp); + const chatGptVersionDate = UsageFormat.formatChatGptVersionDate(chatGptVersion); const chatGptInstallDate = this._chatGptAppInstallDate(chatGptApp); const codexVersion = this._commandVersion(codexPath); const item = new PopupMenu.PopupBaseMenuItem({ @@ -1110,7 +1111,7 @@ class ChatGptUsageApplet extends Applet.Applet { Boolean(chatGptApp), chatGptVersion, "chatgpt", - chatGptInstallDate + chatGptVersionDate || chatGptInstallDate ) ); this._codexButton = this._createLaunchButton( diff --git a/metadata.json b/metadata.json index 82f41c6..78f833b 100644 --- a/metadata.json +++ b/metadata.json @@ -4,7 +4,7 @@ "description": "A tiny Cinnamon companion that keeps ChatGPT Work and Codex usage beautifully in view.", "comments": "Made with love by Claudiu & Codex. 🩷\n\nhttps://github.com/oss-singularity/cinnamon-chatgpt-usage", "contributors": "OSS Singularity — open-source home of the project,Claudiu Schuster — creator and maintainer,OpenAI Codex — design and engineering collaborator", - "version": "0.3.4", + "version": "0.3.5", "author": "OSS Singularity", "max-instances": 1, "cinnamon-version": ["5.8", "6.0", "6.2", "6.4", "6.6"], diff --git a/tests/test-usage-format.js b/tests/test-usage-format.js index 688b7b7..e740433 100644 --- a/tests/test-usage-format.js +++ b/tests/test-usage-format.js @@ -511,6 +511,31 @@ assertEqual( null, "Invalid application package timestamp has no date" ); +assertEqual( + UsageFormat.formatChatGptVersionDate("26.831.20005"), + "31.08.2026", + "ChatGPT version date decodes August 31, 2026" +); +assertEqual( + UsageFormat.formatChatGptVersionDate("26.825.51511"), + "25.08.2026", + "ChatGPT version date decodes August 25, 2026" +); +assertEqual( + UsageFormat.formatChatGptVersionDate("26.406.40811"), + "06.04.2026", + "ChatGPT version date decodes April 6, 2026" +); +assertEqual( + UsageFormat.formatChatGptVersionDate("26.1001.20005"), + "01.10.2026", + "ChatGPT version date supports two-digit months" +); +assertEqual( + UsageFormat.formatChatGptVersionDate("new-version"), + null, + "Unknown ChatGPT version has no decoded build date" +); assertEqual( UsageFormat.formatAppTooltip(true, "codex-cli 0.152.0", "", "01.09.2026"), "codex-cli 0.152.0 — 01.09.2026", diff --git a/usage-format.js b/usage-format.js index 4eebc4b..1570e0d 100644 --- a/usage-format.js +++ b/usage-format.js @@ -527,6 +527,27 @@ function formatLocalDate(epochSeconds) { return dateTime.format("%d.%m.%Y"); } +function formatChatGptVersionDate(version) { + const match = String(version || "").trim().match(/^(\d{2})\.(\d{3,4})\.\d{5}$/); + if (!match) return null; + + const year = 2000 + Number(match[1]); + const dateCode = match[2]; + const month = Number(dateCode.slice(0, -2)); + const day = Number(dateCode.slice(-2)); + const date = new Date(Date.UTC(year, month - 1, day)); + if ( + month < 1 || month > 12 || day < 1 || + date.getUTCFullYear() !== year || + date.getUTCMonth() !== month - 1 || + date.getUTCDate() !== day + ) { + return null; + } + + return `${String(day).padStart(2, "0")}.${String(month).padStart(2, "0")}.${year}`; +} + function formatRelativeTime(epochSeconds, nowSeconds = null) { const updatedSeconds = Number(epochSeconds); const currentSeconds = nowSeconds === null @@ -581,6 +602,7 @@ module.exports = { formatAccessibleTooltip, formatTimestamp, formatLocalDate, + formatChatGptVersionDate, formatRelativeTime, formatAppTooltip };