MuppetGate / Alfred-Workflows-DateCalculator

Date Calculator workflow for Alfred
42 stars 6 forks source link

Request: Flag for inclusive date calculations #15

Open cataclysmicvoid opened 3 years ago

cataclysmicvoid commented 3 years ago

Currently, I believe date arithmetic in this workflow treats "days" as 24 hour periods starting at 00:01, or the specific time inputted in a query.*

For many applications, inclusive date calculations are very useful (e.g. real estate). Any portion of a day is treated a full day in such calculations.

dcalc 12/01/2020-12/31/2020 d Currently gives 30 days (00:01 on Dec. 1 to 00:01 on Dec. 31). But there are 31 days in the month, which is how many days of rent you would pay for the period in question. An inclusive calculation would see that one minute on the 31st of December and count that as the 31st day.

Perhaps a flag could be added (-i) or a setting switch along with the date format options.

Thank you for producing this valuable workflow!

(*Aside: As an exception, dcalc now-tomorrow h appears to output the time in hours until 23:59 the next day — the end of the day — and not 00:01 — the first minute of the next day. At 18:01 dcalc now-tomorrow h gives 36 hours not 6 hours.**)

(**Correction: It looks like it might incorrectly use 00:00 (midnight), which would be the next day, technically. dcalc 12/01/2020@18:00-12/02/2020 M = 1800 minutes, or 00:00 on December 3rd.)