-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transaction validation: date range #91
Conversation
val format = DateTimeFormatter.ISO_LOCAL_DATE | ||
|
||
val from = Try(LocalDate.parse(config.getString("from"), format)).map(Some(_)).getOrElse(None) | ||
val to = Try(LocalDate.parse(config.getString("to"), format)).map(Some(_)).getOrElse(None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For parsing the constraint dates, you could use the same date-parser as used in the .ledger
parser. So the date format will match the one in the .ledger
.
Looks great, thanks! Apart from the review comments, one more thing remains: we need to add a "suppress error" directive, for posting opening balances. |
ca03b71
to
1e87401
Compare
1e87401
to
f5d47ea
Compare
val to = dateTo.getOrElse(LocalDate.MAX) | ||
val date = LocalDate.of(post.date.year, post.date.month, post.date.day) | ||
val from = dateFrom.getOrElse(Date.MIN) | ||
val to = dateTo.getOrElse(Date.MAX) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While MIN and MAX works in most cases, it is hackish. It would be better to use something like this (pseudo code):
dateFrom.map(_ compare post.date).getOrElse(true)
… 3.0.0 is incompatible with scalamock yet - paulbutcher/ScalaMock#147
d741b02
to
8273dff
Compare
@hrj Removed the |
💯 for taking care of everything :) |
Implements #85