From 031219e7929f9c68be2d4b3c36d852929ba9f94f Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Tue, 18 May 2021 10:49:05 -1000 Subject: [PATCH] ;doc: clarify report intervals' effect on begin/end dates (#1561) --- doc/common.m4 | 2 ++ hledger/Hledger/Cli/CliOptions.hs | 4 ++-- hledger/hledger.m4.md | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/common.m4 b/doc/common.m4 index 1f8c781bc..549aa1e7a 100644 --- a/doc/common.m4 +++ b/doc/common.m4 @@ -103,9 +103,11 @@ m4_define({{_reportingoptions_}}, {{ `-b --begin=DATE` : include postings/txns on or after this date + (will be adjusted to preceding subperiod start when using a report interval) `-e --end=DATE` : include postings/txns before this date + (will be adjusted to following subperiod end when using a report interval) `-D --daily` : multiperiod/multicolumn report by day diff --git a/hledger/Hledger/Cli/CliOptions.hs b/hledger/Hledger/Cli/CliOptions.hs index bb54cf619..edc08f3c8 100644 --- a/hledger/Hledger/Cli/CliOptions.hs +++ b/hledger/Hledger/Cli/CliOptions.hs @@ -136,8 +136,8 @@ reportflags :: [Flag RawOpts] reportflags = [ -- report period & interval - flagReq ["begin","b"] (\s opts -> Right $ setopt "begin" s opts) "DATE" "include postings/txns on or after this date" - ,flagReq ["end","e"] (\s opts -> Right $ setopt "end" s opts) "DATE" "include postings/txns before this date" + flagReq ["begin","b"] (\s opts -> Right $ setopt "begin" s opts) "DATE" "include postings/txns on or after this date (will be adjusted to preceding subperiod start when using a report interval)" + ,flagReq ["end","e"] (\s opts -> Right $ setopt "end" s opts) "DATE" "include postings/txns before this date (will be adjusted to following subperiod end when using a report interval)" ,flagNone ["daily","D"] (setboolopt "daily") "multiperiod/multicolumn report by day" ,flagNone ["weekly","W"] (setboolopt "weekly") "multiperiod/multicolumn report by week" ,flagNone ["monthly","M"] (setboolopt "monthly") "multiperiod/multicolumn report by month" diff --git a/hledger/hledger.m4.md b/hledger/hledger.m4.md index 7297db9ca..09a29d730 100644 --- a/hledger/hledger.m4.md +++ b/hledger/hledger.m4.md @@ -493,6 +493,8 @@ Some notes: start/end dates from options and that from `date:` queries. That is, `date:2019-01 date:2019 -p'2000 to 2030'` yields January 2019, the smallest common time span. +- A [report interval](#report-intervals) (see below) will adjust start/end dates, + when needed, so that they fall on subperiod boundaries. Examples: @@ -743,6 +745,8 @@ or `hledger print cur:\\$`. PERIODEXPR is a [period expression](#period-expressions) (with no report interval). Examples: `date:2016`, `date:thismonth`, `date:2000/2/1-2/15`, `date:lastweek-`. If the `--date2` command line flag is present, this matches [secondary dates](#secondary-dates) instead. +([Report intervals](#report-intervals) will adjust [start/end dates](report-start--end-date) +to preceding/following subperiod boundaries.) **`date2:PERIODEXPR`** : match secondary dates within the specified period.