diff --git a/src/ceeker/tui/view.clj b/src/ceeker/tui/view.clj index 6d16187..5434602 100644 --- a/src/ceeker/tui/view.clj +++ b/src/ceeker/tui/view.clj @@ -18,8 +18,8 @@ (def ^:const compact-threshold "Terminal width (columns) below which compact card view is used. - Derived from table row width: prefix(4) + columns + gaps = ~98." - 100) + Derived from table row width: prefix(4) + columns + gaps = 109." + 110) (def ^:const max-card-message-lines "Maximum number of message lines shown in a card." @@ -138,12 +138,12 @@ (conj current-line c) lines)))))))) (def ^:private time-formatter - "HH:mm:ss formatter for local time display. + "yyyy-MM-dd HH:mm:ss formatter for local datetime display. Immutable and safe to initialize at build time." - (DateTimeFormatter/ofPattern "HH:mm:ss")) + (DateTimeFormatter/ofPattern "yyyy-MM-dd HH:mm:ss")) (defn- format-time - "Formats an ISO-8601 UTC timestamp to HH:mm:ss in local timezone. + "Formats an ISO-8601 UTC timestamp to yyyy-MM-dd HH:mm:ss in local timezone. Resolves the system timezone at runtime to avoid baking the build machine's timezone into GraalVM native images." [updated] diff --git a/test/ceeker/tui/view_test.clj b/test/ceeker/tui/view_test.clj index fe00f0b..98c93d4 100644 --- a/test/ceeker/tui/view_test.clj +++ b/test/ceeker/tui/view_test.clj @@ -465,9 +465,9 @@ expected (-> (Instant/parse utc-ts) (.atZone (ZoneId/systemDefault)) (.format (DateTimeFormatter/ofPattern - "HH:mm:ss")))] + "yyyy-MM-dd HH:mm:ss")))] (is (= expected result)) - (is (re-matches #"\d{2}:\d{2}:\d{2}" result))))) + (is (re-matches #"\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}" result))))) (deftest test-format-time-nil-and-short (testing "nil returns empty string" @@ -488,9 +488,19 @@ expected (-> (Instant/parse utc-ts) (.atZone (ZoneId/systemDefault)) (.format (DateTimeFormatter/ofPattern - "HH:mm:ss")))] + "yyyy-MM-dd HH:mm:ss")))] (is (= expected (#'view/format-time utc-ts)))))) +(deftest test-format-session-line-includes-full-datetime + (testing "table rows show full local datetime, not time only" + (let [session (make-session "msg") + plain (strip-ansi (#'view/format-session-line session false)) + expected (-> (Instant/parse (:last-updated session)) + (.atZone (ZoneId/systemDefault)) + (.format (DateTimeFormatter/ofPattern + "yyyy-MM-dd HH:mm:ss")))] + (is (str/includes? plain expected))))) + ;; -- worktree truncation tests -- (deftest test-long-worktree-truncated-in-table @@ -576,3 +586,8 @@ height)) (is (str/includes? plain "project-3")) (is (not (str/includes? plain "project-0")))))) + +(deftest test-use-compact-threshold-covers-datetime-column-width + (testing "auto mode switches to card view below full table width" + (is (false? (#'view/use-compact? :auto 110))) + (is (true? (#'view/use-compact? :auto 109)))))