Open KennethSundqvist opened 5 years ago
Yes, I see what’s happened there. I run the calculation so that folk can put the dates in any order and get the difference between them. That doesn’t work for times though does it (unless you put in the full date). Mmm.
The second one is interesting because I hadn’t thought of parsing the expression like that. It would lead to a horrendous amount of error checking, but perhaps for a limited number if special cases …
I’ll think about both of those when I have more time. I’m snowed under at the moment.
Using the @time
format with date keywords is not a priority for me, and I don't consider it a part of this issue. I only mentioned it as a possible solution to use other than handling the second time value as a time in the future. But since you say it's complicated to implement you don't have to consider it for this issue.
I often use two time values to calculate between today and tomorrow, but the calculator always treat both time values as the same day, no matter which order they are in.
Both
dcalc 01:00 - 22:00
anddcalc 22:00 - 01:00
result in21 hours
. I expect the latter to result in3 hours
.If I include the dates for today and tomorrow, like
dcalc 2019-05-10@22:00 - 2019-05-11@01:00
, i get3 hours
.And using the
@time
format with date keywords, liketoday@22:00
, doesn't work, so I always have to type the full date.