hrj/abandon

Txn Validation: Date range

hrj opened this issue · 4 comments

hrj commented

Often, the input .ledger files are meant for a specific year. It would be nice to validate the date of the transaction, to ensure that the date lies within the year (or quarter, month, whatever).

Many UI based accounting packages do this naturally but since abandon has a text-based input it is easy to make mistakes in the date field. This is especially a problem in countries where the financial year is not aligned with the calendar year. In India, for example, financial year begins in March, and hence dates can get messed up while yanking and pasting.

Plan:

  • Have a config option for specifying the valid date range. (Ref. eodConstraints)
  • We could add a directive to .ledger file to forcefully accept a particular date. Usually, opening balances are posted on the day before the financial year. Since this is an exceptional transaction and we don't want other transactions to be posted on that date, a "force accept date" directive would be useful. The config file constraint can then be set to allow only dates for the financial year.
Entea commented

@hrj Do you mind if I try to submit a PR for this story as an exercise? :)

hrj commented

@Entea Not at all; go ahead :)

hrj commented

For the "suppress error" directive, we can define a special tag. That requires support for tags to be implemented as per #16 .

hrj commented

I created follow up tasks #93 and #94