imp: journal: accept year as a synonym for Y (ledger compat)

This commit is contained in:
Simon Michael 2022-12-21 22:27:08 -10:00
parent 826a7cfb2a
commit 95d7679f6d
5 changed files with 31 additions and 10 deletions

View File

@ -575,7 +575,7 @@ payeedirectivep = do
defaultyeardirectivep :: JournalParser m ()
defaultyeardirectivep = do
char 'Y' <?> "default year"
(string "Y" <|> string "year") <?> "default year"
lift skipNonNewlineSpaces
setYear =<< lift yearp

View File

@ -2641,7 +2641,7 @@ and less trustworthy in an audit.
### Default year
You can set a default year to be used for subsequent dates which don't
specify a year. This is a line beginning with `Y` followed by the year. Eg:
specify a year. This is a line beginning with `Y` or `year` followed by the year. Eg:
```journal
Y2009 ; set default year to 2009
@ -2650,7 +2650,7 @@ Y2009 ; set default year to 2009
expenses 1
assets
Y2010 ; change default year to 2010
year 2010 ; change default year to 2010
2009/1/30 ; specifies the year, not affected
expenses 1

View File

@ -18,3 +18,14 @@ a:b
aa:b
c
<
Y 1111
1/1
year 2222
2/2
$ hledger -f- print
1111-01-01
2222-02-02
>=

View File

@ -130,13 +130,6 @@ $ hledger -f- check
>2//
>=1
# `year`/`Y` set the year for year-less dates
<
year 2022
$ hledger -f- check
>2//
>=1
# `C AMT1 = AMT2` declare a commodity equivalency
<
C $ 1 USD
@ -151,3 +144,7 @@ o 2013/04/05 13:30:00
$ hledger -f- check
>2//
>=1
# amount expressions
# lot notation

View File

@ -33,3 +33,16 @@ $ hledger -f- check
(budget:food) *-1
$ hledger -f- check
# `Y`/`year` set the year for year-less dates
<
Y 1111
1/1
year 2222
2/2
$ hledger -f- print
1111-01-01
2222-02-02
>=