Alfred-Workflows-DateCalculator icon indicating copy to clipboard operation
Alfred-Workflows-DateCalculator copied to clipboard

Understand that the second time value is in the future

Open KennethSundqvist opened this issue 6 years ago • 2 comments

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 and dcalc 22:00 - 01:00 result in 21 hours. I expect the latter to result in 3 hours.

If I include the dates for today and tomorrow, like dcalc 2019-05-10@22:00 - 2019-05-11@01:00, i get 3 hours.

And using the @time format with date keywords, like today@22:00, doesn't work, so I always have to type the full date.

KennethSundqvist avatar May 10 '19 09:05 KennethSundqvist

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.

MuppetGate avatar May 10 '19 09:05 MuppetGate

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.

KennethSundqvist avatar May 10 '19 11:05 KennethSundqvist