Commit Graph

157 Commits

Author SHA1 Message Date
Simon Michael
75a6c1e510 fix: "every 29th/30th/31st day of month" dates with a start date (fix #2032)
Since hledger 1.25, "every Nth day of month" period rules with N > 28
could be off by a couple of days if given certain forecast start dates.
Eg `~ every 31st day of month` with `--forecast='2023-03-30..'`.
2023-05-03 19:18:35 -10:00
Simon Michael
c790aa6145 ;dev: lib: also build with GHC 9.6.1; add base-compat 2023-03-14 10:42:48 -10:00
Simon Michael
fa70f160ae imp: partial/inferred dates are flexible, full dates are not (#1982)
DateSpans are now now aware of exact/flexible dates.
2023-02-17 07:24:19 -10:00
Simon Michael
5537a251f3 imp: journal: periodic txns need not start on an interval boundary
Eg, ~ monthly from 1/15 now works, instead of giving an error message.
2023-02-17 07:24:19 -10:00
Simon Michael
93f74f7a0e lib: Hledger.Data.Dates: intervalStartBefore -> intervalBoundaryBefore 2023-01-11 20:51:24 -10:00
Simon Michael
e2ddf1e685 imp: add "since" as a synonym of "from" in period expressions (ledger compat) 2022-12-22 02:12:25 -10:00
Simon Michael
7fd25809e8 dev: fix customErrorBundlePretty import warnings 2022-10-07 07:43:28 -10:00
Simon Michael
c80c72d7cd dev: lib, cli, bin: enable/fix name shadowing warnings
And a few other cleanups.
2022-08-23 12:16:15 +01:00
Simon Michael
42bcbad2fd imp: bal: budget goals now respect -H (#1879) 2022-07-09 09:59:17 +01:00
Simon Michael
dd14f9c822 imp: lib: Hledger.Utils.Parse: export HledgerParseErrors 2022-06-29 09:58:56 +01:00
Simon Michael
5ab7b9f643 ref: HledgerParseErrors type alias 2022-04-25 02:56:59 -10:00
Simon Michael
2f28e1b0a7 ref: rename CustomErr -> HledgerParseErrorData
Verbose, but use every chance to clarify the complicated parse error
situation.
2022-04-25 02:56:59 -10:00
Simon Michael
53332ee6a5 stack: re-enable hledger-web with ghc 9.2 2022-04-15 15:07:17 -10:00
Simon Michael
a2f6b30fbd cln: silence some warnings/lints 2022-03-26 08:34:21 -10:00
Stephen Morgan
bffb6c8c82 ref: smartdate: Improve ergonomics of SmartDate constructors. 2022-03-25 19:10:58 -10:00
Simon Michael
929f13ec03 fix: warning (#1799) 2022-01-26 09:00:40 -10:00
Stephen Morgan
e33de3585b ref: Clean up splitSpan, to make the logic clearer and more extensible.
Previously the helper functions splitspan and splitspan' would calculate
each span from the start point of the previous span. This meant we had
to be very careful not to lose any relevant information (e.g. what day
of the week it was) about the original start date. We now calculate each
span from the original start date, so there's no risk of losing
information. This simplifies many of the calculations.
2022-01-26 08:05:37 -10:00
Stephen Morgan
ea51a87bd0 cln: Remove under-used maybePeriod, which is only used as a stand-in for
Just . parsePeriodExpr' in tests.
2022-01-26 08:05:37 -10:00
Stephen Morgan
43b7e849c7 cln: Remove some explicit Text packing. 2022-01-26 08:05:37 -10:00
Stephen Morgan
f13ac2812f imp: smartdates: Simplify and generalise the SmartDate constructor and
parsers to allow for arbitrary numbers of periods in relative dates.

We now accept smart dates like “in 5 days, 5 weeks ahead, in -6 months, 2 quarters ago”.
2022-01-11 13:31:29 -10:00
Stephen Morgan
1bc04685b7 pkg: Drop base-compat-batteries dependency.
Our supported stackage versions are now new enough that we don't need
any of the compatibility features anymore.
2021-10-31 07:56:07 -10:00
Stephen Morgan
35c33f342b cln: Move column grouping functions form Report.PostingsReport to Data.Dates. 2021-09-18 14:40:28 -10:00
Stephen Morgan
8274da81fc cln: tests: Remove test and tests, which are just aliases for testCase
and testGroup.

Replacing these removes a layer of indirection, and reduces the need to
depend on Hledger.Utils.Test.
2021-08-30 16:32:19 -10:00
Stephen Morgan
32dad455fd cln: hlint: Clean up section related warnings. 2021-08-27 06:13:56 -10:00
Stephen Morgan
8bf7c95697 cln: hlint: Clean up Functor related hlint warnings, and NOINLINE warning. 2021-08-27 06:13:56 -10:00
Stephen Morgan
21e62ffcbd cln: hlint: Remove unless and $> warnings. 2021-08-27 06:13:56 -10:00
Stephen Morgan
fed75c58e9 cln: hlint: Clean up hlint warnings not already ignored in hlint.yaml. 2021-08-25 20:44:36 -10:00
Lawrence
8a5addfb02 lib: implement periodic expressions for weekday et al
Implementation lifts DayOfWeek (renamed to DaysOfWeek) to a list of
days. This should match the previous behavior for single-element lists
2021-08-20 20:30:18 -05:00
Stephen Morgan
e3ec01c3c6 lib,cli,ui: Use Text for showDate and related. 2021-01-02 15:08:09 +11:00
Simon Michael
a97daaf322 lib: replace pretty-show with pretty-simple
pretty-simple, already used in .ghci, will hopefully give nicer debug
output, including for values which don't have Read-able Show output.
This should mean that we can start removing custom string-like Show
instances that were a workaround for pretty-show.

We are using the latest version (4.0.0.0) to get compact output.
Here's some old pretty-show output:

 CsvRules
   { rdirectives = [ ( "skip" , "1" ) ]
   , rcsvfieldindexes = [ ( "date" , 1 ) , ( "amount" , 2 ) ]
   , rassignments = [ ( "amount" , "%2" ) , ( "date" , "%1" ) ]
   , rconditionalblocks = []
   }

And the new pretty-simple output:

 CsvRules
   { rdirectives=
     [ ( "skip", "1" ) ]
   , rcsvfieldindexes=
     [ ( "date", 1 ), ( "amount", 2 ) ]
   , rassignments=
     [ ( "amount", "%2" ), ( "date", "%1" ) ]
   , rconditionalblocks= []
   }

Non-compact pretty-simple output would be:

 CsvRules
     { rdirectives=
         [
             ( "skip"
             , "1B"
             )
         ]
     , rcsvfieldindexes=
         [
             ( "date"
             , 1
             )
         ,
             ( "amount"
             , 2
             )
         ]
     , rassignments=
         [
             ( "amount"
             , "%2"
             )
         ,
             ( "date"
             , "%1"
             )
         ]
     , rconditionalblocks=[]
     }

Also:

- Account's Show instance no longer converts : to _ in account names

- drop unused pretty-show dependency from hledger, hledger-ui packages

- regenerate hledger-lib with the older hpack that's shipped in stack
2020-11-10 08:06:11 -08:00
Stephen Morgan
5a6d38fdf2 lib: For ymd date parsing, don't consume invalid date components. 2020-10-18 21:28:46 -07:00
Stephen Morgan
ca2e55c954 lib: Replace some fromIntegral with toInteger. 2020-08-30 22:20:58 +10:00
Stephen Morgan
371b349b2e lib,cli: Replace parsedate and mkdatespan with direct applications of fromGregorian, transaction now takes Day instead of a date string. 2020-08-29 15:08:28 -07:00
Stephen Morgan
2fd678e415 lib,cli,ui: Remove old CPP directives made redundant by version bounds. 2020-08-29 15:08:28 -07:00
Stephen Morgan
f2dcbd2fee lib: Make ill-formed SmartDates unrepresentable. 2020-08-07 14:20:08 -07:00
Simon Michael
3f55c23603 ;review, tag all error calls with an easier to find PARTIAL: comment (#1312) 2020-08-05 16:08:33 -07:00
Stephen Morgan
08ad220448 lib: In quarterdatespanp, use yearp and allow uppercase Q. 2020-08-04 09:10:53 -07:00
Henning Thielemann
9c9701fe7d lib: quarterdatespanp (fixes #1247) 2020-07-31 17:37:41 -07:00
Henning Thielemann
ccac09fb1b lib: doubledatespanp: fix and re-enable doctest 2020-07-31 17:37:41 -07:00
Stephen Morgan
ffb5cf0773 lib: Ensure parsed years have at least 4 digits. 2020-07-31 17:22:27 -07:00
Stephen Morgan
7b9f9ae49c lib: Refactor reportingintervalp to be more compact and do less backtracking. 2020-07-31 17:22:27 -07:00
Stephen Morgan
696d9c73b0 lib: Remove unnecessary try in parsers, replace unnecessary string' with string, rewrite some parsers in applicative style. 2020-07-31 17:22:27 -07:00
Stephen Morgan
081ee390ab lib: Change skipMany spacenonewline to takeWhileP Nothing isNonNewlineSpace. 2020-07-22 14:58:53 -07:00
Simon Michael
4b9a76068f lib: spanStartYear, spanEndYear, spanYears DateSpan helpers 2020-07-09 12:52:40 -07:00
Stephen Morgan
b3cd865786 lib: Add fortnightly as a synonym for biweekly. 2020-06-23 06:48:20 -07:00
Stephen Morgan
be25fe360e lib: Parser now accepts .. as a synonym for to in date ranges. 2020-06-04 19:30:42 -07:00
Stephen Morgan
2f71da8838 lib: More consistent period formatting. 2020-06-04 19:30:42 -07:00
Simon Michael
10f8dc84a5 period expressions: allow "until", like Ledger (synonym for "to") 2020-04-08 14:26:38 -07:00
Stephen Morgan
702c958487 lib: Replace some utility functions with library functions. 2020-03-02 12:45:30 -08:00
Simon Michael
43c55bf4ea ;lib: add YYYY.MM.DD to parsedate/parsedateM helpers
For a bit more consistency with simple dates. And document better.
2020-02-27 10:57:55 -08:00