Change Date output to yyyy-mm-dd

This commit is contained in:
Brian Wignall 2019-12-29 17:27:01 -05:00 committed by Simon Michael
parent be72497ebb
commit 35481a665b
2 changed files with 4 additions and 3 deletions

View File

@ -115,7 +115,7 @@ instance Show DateSpan where
-- show s = "DateSpan \"" ++ showDateSpan s ++ "\"" -- quotes to help pretty-show -- show s = "DateSpan \"" ++ showDateSpan s ++ "\"" -- quotes to help pretty-show
showDate :: Day -> String showDate :: Day -> String
showDate = formatTime defaultTimeLocale "%0C%y/%m/%d" showDate = show
-- | Render a datespan as a display string, abbreviating into a -- | Render a datespan as a display string, abbreviating into a
-- compact form if possible. -- compact form if possible.

View File

@ -30,7 +30,7 @@ import Data.Maybe
import Data.Text (Text) import Data.Text (Text)
import qualified Data.Text as T import qualified Data.Text as T
import Data.Time.Calendar (Day) import Data.Time.Calendar (Day)
import Data.Time.Format (formatTime, defaultTimeLocale) import Data.Time.Format (formatTime, defaultTimeLocale, iso8601DateFormat)
import Data.Typeable (Typeable) import Data.Typeable (Typeable)
import Safe (headDef, headMay, atMay) import Safe (headDef, headMay, atMay)
import System.Console.CmdArgs.Explicit import System.Console.CmdArgs.Explicit
@ -164,7 +164,8 @@ confirmedTransactionWizard prevInput es@EntryState{..} stack@(currentStage : _)
{ esArgs = drop 1 esArgs { esArgs = drop 1 esArgs
, esDefDate = date , esDefDate = date
} }
dateAndCodeString = formatTime defaultTimeLocale "%Y/%m/%d" date ++ (if T.null code then "" else " (" ++ T.unpack code ++ ")") dateAndCodeString = formatTime defaultTimeLocale yyyymmddFormat date ++ (if T.null code then "" else " (" ++ T.unpack code ++ ")")
yyyymmddFormat = iso8601DateFormat Nothing
confirmedTransactionWizard prevInput{prevDateAndCode=Just dateAndCodeString} es' (EnterDescAndComment (date, code) : stack) confirmedTransactionWizard prevInput{prevDateAndCode=Just dateAndCodeString} es' (EnterDescAndComment (date, code) : stack)
Nothing -> Nothing ->
confirmedTransactionWizard prevInput es stack confirmedTransactionWizard prevInput es stack