bs/bse/cf/is: show local abbreviated month names on monthly columns
This commit is contained in:
parent
3663c46502
commit
e9624486b6
@ -40,6 +40,7 @@ module Hledger.Data.Dates (
|
|||||||
parsedate,
|
parsedate,
|
||||||
showDate,
|
showDate,
|
||||||
showDateSpan,
|
showDateSpan,
|
||||||
|
showDateSpanMonthAbbrev,
|
||||||
elapsedSeconds,
|
elapsedSeconds,
|
||||||
prevday,
|
prevday,
|
||||||
parsePeriodExpr,
|
parsePeriodExpr,
|
||||||
@ -110,6 +111,11 @@ showDate = formatTime defaultTimeLocale "%0C%y/%m/%d"
|
|||||||
showDateSpan :: DateSpan -> String
|
showDateSpan :: DateSpan -> String
|
||||||
showDateSpan = showPeriod . dateSpanAsPeriod
|
showDateSpan = showPeriod . dateSpanAsPeriod
|
||||||
|
|
||||||
|
-- | Like showDateSpan, but show month spans as just the abbreviated month name
|
||||||
|
-- in the current locale.
|
||||||
|
showDateSpanMonthAbbrev :: DateSpan -> String
|
||||||
|
showDateSpanMonthAbbrev = showPeriodMonthAbbrev . dateSpanAsPeriod
|
||||||
|
|
||||||
-- | Get the current local date.
|
-- | Get the current local date.
|
||||||
getCurrentDay :: IO Day
|
getCurrentDay :: IO Day
|
||||||
getCurrentDay = do
|
getCurrentDay = do
|
||||||
|
|||||||
@ -144,6 +144,13 @@ showPeriod (PeriodFrom b) = formatTime defaultTimeLocale "%0C%y/%m/%d-" b
|
|||||||
showPeriod (PeriodTo e) = formatTime defaultTimeLocale "-%0C%y/%m/%d" (addDays (-1) e) -- -INCLUSIVEENDDATE
|
showPeriod (PeriodTo e) = formatTime defaultTimeLocale "-%0C%y/%m/%d" (addDays (-1) e) -- -INCLUSIVEENDDATE
|
||||||
showPeriod PeriodAll = "-"
|
showPeriod PeriodAll = "-"
|
||||||
|
|
||||||
|
-- | Like showPeriod, but if it's a month period show just
|
||||||
|
-- the 3 letter month name abbreviation for the current locale.
|
||||||
|
showPeriodMonthAbbrev (MonthPeriod _ m) -- Jan
|
||||||
|
| m >= 0 && m < length monthnames = snd $ monthnames !! (m-1)
|
||||||
|
where monthnames = months defaultTimeLocale
|
||||||
|
showPeriodMonthAbbrev p = showPeriod p
|
||||||
|
|
||||||
periodStart :: Period -> Maybe Day
|
periodStart :: Period -> Maybe Day
|
||||||
periodStart p = mb
|
periodStart p = mb
|
||||||
where
|
where
|
||||||
|
|||||||
@ -408,7 +408,7 @@ compoundBalanceReportAsHtml ropts cbr =
|
|||||||
[tr_ $ th_ [colspanattr, leftattr] $ toHtml title]
|
[tr_ $ th_ [colspanattr, leftattr] $ toHtml title]
|
||||||
++ [thRow $
|
++ [thRow $
|
||||||
"" :
|
"" :
|
||||||
map showDateSpan colspans
|
map showDateSpanMonthAbbrev colspans
|
||||||
++ (if row_total_ ropts then ["Total"] else [])
|
++ (if row_total_ ropts then ["Total"] else [])
|
||||||
++ (if average_ ropts then ["Average"] else [])
|
++ (if average_ ropts then ["Average"] else [])
|
||||||
]
|
]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user