From 0c809ee14c9acb07c927f1057c02bc0a91558034 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Fri, 16 Sep 2022 23:00:29 -0400 Subject: more output tweaking --- countdown.hs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/countdown.hs b/countdown.hs index 419a7c8..d630287 100755 --- a/countdown.hs +++ b/countdown.hs @@ -215,8 +215,10 @@ countdownWidget isSimulated t = borderWithLabel (str "Cosmic Conversion") (hBox [cosmicConversion, cosmicConversion']) ]) where - cosmicCalendarPrevious = borderWithLabel (str "Last on the Cosmic Calendar") $ (str " ") <=> prevEntry - cosmicCalendarNext = borderWithLabel (str "Next on the Cosmic Calendar") $ (str " ") <=> nextEntry + cosmicCalendarPrevious = borderWithLabel (str "Previously on the Cosmic Calendar") prevEntry + cosmicCalendarNext = borderWithLabel (str $ (if current then "Now" else "Next") ++ " on the Cosmic Calendar") nextEntry + where + current = True -- TODO: We want to display "today" or "now" on the cosmic calendar; -- We want to display what happened previously on the cosmic calendar @@ -242,9 +244,15 @@ countdownWidget isSimulated t = box = borderWithLabel (txt calTitle) $ vBox [ hCenter $ txt $ calSubtitle, str "\n", - str $ show $ calBeginTime `addLocalTime` yearStart t, - str $ showLarge years ++ " years", - str $ printf "%s years ago" (commas $ ageOfUniverseInYears - floor years), + hBox [ + str $ formatTime defaultTimeLocale "%A, %B %e%n%Y-%m-%d %r" $ calBeginTime `addLocalTime` yearStart t, + padLeft Max $ vBox [ + str $ showLarge years ++ " years", + str $ printf "%s years ago" $ showLarge $ realToFrac (ageOfUniverseInYears - floor years) + ] + ], + -- str $ printf "%s years ago" (commas $ ageOfUniverseInYears - floor years), + str $ printf "%s years ago" $ showLarge $ realToFrac (ageOfUniverseInYears - floor years), str "\n", txtWrap calDescription ] -- cgit v1.2.3