doc: manual: clarify secondary & posting dates
This commit is contained in:
parent
be56a140f6
commit
68409eca7b
@ -206,40 +206,69 @@ an equals sign. The *primary date*, on the left, is used by default; the
|
|||||||
*secondary date*, on the right, is used when the `--date2` flag is specified
|
*secondary date*, on the right, is used when the `--date2` flag is specified
|
||||||
(For Ledger compatibility, `--aux-date` or `--effective` also work.)
|
(For Ledger compatibility, `--aux-date` or `--effective` also work.)
|
||||||
|
|
||||||
Their meaning is up to you, but it's best to follow a consistent rule. I
|
Their meaning is up to you, but it's best to follow a consistent rule.
|
||||||
write the bank's clearing date as primary, and the date I initiated the
|
Eg write the bank's clearing date as primary, and when needed, the
|
||||||
transaction as secondary (if needed).
|
date the transaction was initiated as secondary.
|
||||||
|
|
||||||
Example:
|
Here's an example. Note that a secondary date will use the year of the
|
||||||
|
primary date if unspecified.
|
||||||
|
|
||||||
``` {.journal}
|
```journal
|
||||||
; PRIMARY=SECONDARY
|
|
||||||
; The secondary date's year is optional, defaulting to the primary's
|
|
||||||
2010/2/23=2/19 movie ticket
|
2010/2/23=2/19 movie ticket
|
||||||
expenses:cinema $10
|
expenses:cinema $10
|
||||||
assets:checking
|
assets:checking
|
||||||
|
```
|
||||||
|
|
||||||
|
```{.shell}
|
||||||
$ hledger register checking
|
$ hledger register checking
|
||||||
2010/02/23 movie ticket assets:checking $-10 $-10
|
2010/02/23 movie ticket assets:checking $-10 $-10
|
||||||
|
```
|
||||||
|
|
||||||
|
```{.shell}
|
||||||
$ hledger register checking --date2
|
$ hledger register checking --date2
|
||||||
2010/02/19 movie ticket assets:checking $-10 $-10
|
2010/02/19 movie ticket assets:checking $-10 $-10
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Secondary dates require some effort: you must use them consistently in
|
||||||
|
your journal entries and remember whether to use or not use the
|
||||||
|
`--date2` flag for your reports. Arguably they are now obsolete,
|
||||||
|
superseded by...
|
||||||
|
|
||||||
##### Posting dates
|
##### Posting dates
|
||||||
|
|
||||||
[Comments and tags](#comments) are covered below, but while we are talking
|
You can give individual postings a different date from their parent
|
||||||
about dates: you can give individual postings a different date from their
|
transaction, by adding a [posting tag](#tags) (see below) like
|
||||||
parent transaction, by adding a posting tag like `date:DATE`, where DATE is
|
`date:DATE`, where DATE is a [simple date](#simple-dates). This is
|
||||||
a [simple date](#simple-dates). The secondary date can be set with
|
probably the best way to control posting dates precisely. Eg in this
|
||||||
`date2:DATE2`. If present, these dates will take precedence in reports.
|
example the expense should appear in May reports, and the deduction
|
||||||
|
from checking should be reported on 6/1 for easy bank reconciliation:
|
||||||
|
|
||||||
Ledger's bracketed posting date syntax (`[DATE]`,
|
``` {.journal}
|
||||||
`[DATE=DATE2]` or `[=DATE2]` in a posting comment)
|
2015/5/30
|
||||||
is also supported, as an alternate spelling of the date and date2 tags.
|
expenses:food $10 ; food purchased on saturday 5/30
|
||||||
|
assets:checking ; bank cleared it on monday, date:6/1
|
||||||
|
```
|
||||||
|
|
||||||
Note: if you do use either of these forms, be sure to give them a valid DATE
|
```{.shell}
|
||||||
or you'll get a parse error, eg an empty `date:` tag is not allowed.
|
$ hledger -f tt.j register food
|
||||||
|
2015/05/30 expenses:food $10 $10
|
||||||
|
```
|
||||||
|
|
||||||
|
```{.shell}
|
||||||
|
$ hledger -f tt.j register checking
|
||||||
|
2015/06/01 assets:checking $-10 $-10
|
||||||
|
```
|
||||||
|
|
||||||
|
A posting date will use the year of the transaction date if unspecified.
|
||||||
|
|
||||||
|
You can also set the secondary date, with `date2:DATE2`.
|
||||||
|
For compatibility, Ledger's older posting date syntax is also
|
||||||
|
supported: `[DATE]`, `[DATE=DATE2]` or `[=DATE2]` in a posting
|
||||||
|
comment.
|
||||||
|
|
||||||
|
When using any of these forms, be sure to provide a valid simple date
|
||||||
|
or you'll get a parse error. Eg a `date:` tag with no value is not
|
||||||
|
allowed.
|
||||||
|
|
||||||
#### Account names
|
#### Account names
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user