Are you using bracketed dates in comments ?

100 views
Skip to first unread message

Simon Michael

unread,
May 18, 2018, 12:13:30 AM5/18/18
to hledger, ledge...@googlegroups.com
Hey all, 

in Ledger and hledger journals you can set eg a posting's date by writing ; [DATE], a square-bracketed date anywhere in the comment.

I believe in both you can also write ; date:DATE or similar, a tag/metadata with that name anywhere in the comment.

More details at eg http://hledger.org/journal.html#posting-dates. My understanding is the bracketed syntax came first.

We are discussing some ambiguities in parsing that arise, at https://github.com/simonmichael/hledger/issues/778 .

And basically, awjchen and I are wondering if anybody uses bracketed dates are used, or how you'd feel if they were dropped, or what thoughts you might have about issues raised on #778.

Best!

John Wiegley

unread,
May 18, 2018, 1:38:29 AM5/18/18
to Simon Michael, hledger, ledge...@googlegroups.com
>>>>> "SM" == Simon Michael <si...@joyful.com> writes:

SM> And basically, awjchen and I are wondering if anybody uses bracketed dates
SM> are used, or how you'd feel if they were dropped, or what thoughts you
SM> might have about issues raised on #778.

Brackets came first, yes, by several years. I still use them, though, because
they're quick and convenient.

John

Martin Michlmayr

unread,
May 18, 2018, 4:31:10 AM5/18/18
to ledge...@googlegroups.com, hledger
* Simon Michael <si...@joyful.com> [2018-05-17 21:13]:
> in Ledger and hledger journals you can set eg a posting's date by writing ; [DATE], a square-bracketed date anywhere in the comment.
>
> I believe in both you can also write ; date:DATE or similar, a tag/metadata with that name anywhere in the comment.

Wow, it seems like I learn about new ledger syntax every day.

I can see why an effective date / aux date makes sense on a
posting-level but why a regular date? John, how do you use that? Why
would a primary posting-date (rather than aux date) differ from the
transaction date?

--
Martin Michlmayr
https://www.cyrius.com/

John Wiegley

unread,
May 18, 2018, 1:52:51 PM5/18/18
to Martin Michlmayr, ledge...@googlegroups.com, hledger
>>>>> "MM" == Martin Michlmayr <t...@cyrius.com> writes:

MM> I can see why an effective date / aux date makes sense on a
MM> posting-level but why a regular date? John, how do you use that? Why
MM> would a primary posting-date (rather than aux date) differ from the
MM> transaction date?

I try not to pre-decide how people will use Ledger's features, under the
philosophy of "I supply the calculator, you supply the meaning".

So, although I don't have an example off the top of my head, that's not enough
reason to discourage its use. You may want to interpret the transaction's date
as the "auxiliary" date (for example, the date of final resolution), with all
the primary dates on the posting being the dates when the actual transactions
occurred.

John

Simon Michael

unread,
May 18, 2018, 1:59:00 PM5/18/18
to John Wiegley, hledger, ledge...@googlegroups.com

> On May 17, 2018, at 10:38 PM, John Wiegley <jwie...@gmail.com> wrote:
> Brackets came first, yes, by several years. I still use them, though, because
> they're quick and convenient.

Good! I've been remembering correctly. Agreed, they are slightly quicker and more convenient than writing the tag/metadata syntax. I find myself starting to use them.

Alan

unread,
May 23, 2022, 7:41:53 PMMay 23
to Ledger
I use bracketed dates. However, recently I've been having some trouble getting them to work.

I thought they were working before, although I can't be sure I remember exactly. They're supposed to be used if you give the "--effective" command-line flag, right?

Martin Michlmayr

unread,
May 23, 2022, 7:49:11 PMMay 23
to ledge...@googlegroups.com
Yes, please post an example. Maybe you're not using them correctly.

* Alan <sf.f...@gmail.com> [2022-05-23 16:41]:
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "Ledger" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/63559a15-c59e-4792-a3bf-6ee48afca9bfn%40googlegroups.com.

Alan

unread,
May 23, 2022, 9:32:23 PMMay 23
to Ledger
Ah! The exercise of trying to put together an example made me realize my mistake.

Referring to the "Bountiful Blessings" example in the Effective Dates manual, if you say `ledger --effective register Groceries` you get the proper effective dates. If you instead say `ledger --effective register Checking` you would get just the one date, 2008/10/16, which makes sense now that I think about it. But I was somehow expecting/hoping that it would show separate lines in the Checking register, with the same effective dates from the Expenses lines.

Martin Michlmayr

unread,
May 23, 2022, 9:46:28 PMMay 23
to ledge...@googlegroups.com
* Alan <sf.f...@gmail.com> [2022-05-23 18:32]:
> Referring to the "Bountiful Blessings" example in the Effective Dates manual
> <https://www.ledger-cli.org/3.0/doc/ledger3.html#Effective-Dates>, if you
> say `ledger --effective register Groceries` you get the proper effective
> dates. If you instead say `ledger --effective register Checking` you would
> get just the one date, 2008/10/16, which makes sense now that I think about
> it. But I was somehow expecting/hoping that it would show separate lines in
> the Checking register, with the same effective dates from the Expenses
> lines.

If you want to same effective date for checking and expenses, you have
to add the effective date on the transaction header:

2020-05-20=2020-02-03 * Foo

You probably have it on the posting using the ; [...] syntax. If you
do this, it only applies to the posting.

In other words: there are two ways to specify effective dates, one is
for the whole transaction and one is only for a posting.

Martin

Simon Michael

unread,
May 25, 2022, 9:59:32 PMMay 25
to ledge...@googlegroups.com
My recollection (and it could be wrong, I haven't checked docs or tested
with Ledger) is:

; [DATE] ; sets posting date
; [=EDATE] ; sets posting effective date
; [DATE=EDATE] ; sets both posting dates

Reply all
Reply to author
Forward
0 new messages