hledger-iadd 1.3.5 → 1.3.6
raw patch · 6 files changed
+30/−9 lines, 6 filesdep ~hledger-lib
Dependency ranges changed: hledger-lib
Files
- ChangeLog.md +5/−1
- hledger-iadd.cabal +2/−1
- src/Data/Time/Ext.hs +16/−0
- src/DateParser.hs +3/−3
- src/Model.hs +2/−2
- src/main/Main.hs +2/−2
ChangeLog.md view
@@ -1,6 +1,10 @@+# 1.3.6++ - bugfix: Use local time instead of UTC everywhere+ # 1.3.5 - - Fix suite build with hledger-lib 1.9.1+ - Fix build with hledger-lib 1.9.1 # 1.3.4
hledger-iadd.cabal view
@@ -1,5 +1,5 @@ name: hledger-iadd-version: 1.3.5+version: 1.3.6 synopsis: A terminal UI as drop-in replacement for hledger add description: This is a terminal UI as drop-in replacement for hledger add. .@@ -56,6 +56,7 @@ , Brick.Widgets.Edit.EmacsBindings , Brick.Widgets.Border.Utils , Text.Megaparsec.Compat+ , Data.Time.Ext default-language: Haskell2010 build-depends: base >= 4.9 && < 5 , hledger-lib >= 1.5 && < 2.0
+ src/Data/Time/Ext.hs view
@@ -0,0 +1,16 @@+-- | Some helper functions for "Data.Time"+module Data.Time.Ext+ ( module Data.Time+ , getLocalTime+ , getLocalDay+ ) where++import Data.Time++-- | Return the current time in the system time zone.+getLocalTime :: IO LocalTime+getLocalTime = zonedTimeToLocalTime <$> getZonedTime++-- | Return the current day in the system time zone.+getLocalDay :: IO Day+getLocalDay = localDay <$> getLocalTime
src/DateParser.hs view
@@ -28,7 +28,7 @@ import Data.Text.Lazy.Builder (Builder, toLazyText) import qualified Data.Text.Lazy.Builder as Build import qualified Data.Text.Lazy.Builder.Int as Build-import Data.Time hiding (parseTime)+import Data.Time.Ext hiding (parseTime) import Data.Time.Calendar.WeekDate import qualified Hledger.Data.Dates as HL import Text.Megaparsec.Compat@@ -54,7 +54,7 @@ Left err -> Left $ T.pack $ parseErrorPretty err parseHLDateWithToday :: Text -> IO (Either Text Day)-parseHLDateWithToday text = flip parseHLDate text . utctDay <$> getCurrentTime+parseHLDateWithToday text = flip parseHLDate text <$> getLocalDay -- | Corresponds to %d[.[%m[.[%y]]]] german :: DateFormat@@ -94,7 +94,7 @@ -- | Parse text with given format and fill in missing fields with todays date. parseDateWithToday :: DateFormat -> Text -> IO (Either Text Day) parseDateWithToday spec text = do- today <- utctDay <$> getCurrentTime+ today <- getLocalDay return (parseDate today spec text) parseDate :: Day -> DateFormat -> Text -> Either Text Day
src/Model.hs view
@@ -27,7 +27,7 @@ import Data.Ord (Down(..)) import Data.Text (Text) import qualified Data.Text as T-import Data.Time hiding (parseTime)+import Data.Time.Ext hiding (parseTime) import qualified Hledger as HL import AmountParser@@ -112,7 +112,7 @@ -- For example, it suggests today for the date prompt suggest :: HL.Journal -> DateFormat -> Step -> IO (Maybe Text) suggest _ dateFormat (DateQuestion _) =- Just . printDate dateFormat . utctDay <$> getCurrentTime+ Just . printDate dateFormat <$> getLocalDay suggest _ _ (DescriptionQuestion _ _) = return Nothing suggest journal _ (AccountQuestion trans _) = return $ if numPostings trans /= 0 && transactionBalanced trans
src/main/Main.hs view
@@ -11,10 +11,10 @@ ( Widget, App(..), AttrMap, BrickEvent(..), Next, EventM , (<=>), (<+>), txt, continue, halt, attrMap, on, fg , defaultMain, showFirstCursor, padBottom, Padding(Max,Pad)- , vLimit, padTopBottom, vSize, Size(Fixed), padAll, padLeft+ , padAll, padLeft ) import Brick.Widgets.BetterDialog (dialog)-import Brick.Widgets.Border (hBorder, vBorder)+import Brick.Widgets.Border (hBorder) import Brick.Widgets.Edit.EmacsBindings ( Editor, renderEditor, handleEditorEvent, getEditContents, editContentsL , editorText