showDate: use '%0C' to get a two-digit century with time-1.4.0.1 or later

This commit is contained in:
Peter Simons 2014-03-22 11:31:13 +01:00
parent 25a8aa2970
commit a56231751f

View File

@ -77,9 +77,8 @@ import Text.Printf
import Hledger.Data.Types
import Hledger.Utils
showDate :: Day -> String
showDate = formatTime defaultTimeLocale "%C%y/%m/%d"
showDate = formatTime defaultTimeLocale "%0C%y/%m/%d"
showDateSpan (DateSpan from to) =
concat
@ -727,6 +726,7 @@ tests_Hledger_Data_Dates = TestList
,"fixSmartDateStr" ~: do
let gives = is . fixSmartDateStr (parsedate "2008/11/26")
"0000-01-01" `gives` "0000/01/01"
"1999-12-02" `gives` "1999/12/02"
"1999.12.02" `gives` "1999/12/02"
"1999/3/2" `gives` "1999/03/02"