MuppetGate / Alfred-Workflows-DateCalculator

Date Calculator workflow for Alfred
42 stars 6 forks source link

Date miscalculation #8

Open truthdoug opened 8 years ago

truthdoug commented 8 years ago

Today I installed this workflow and tried a couple calculations. One was off by a month.

After setting my date format to 'YYYY-MM-DD', I tried:

dcalc today - 2016-05-31

I get 2 months, 1 day. But today is Sept. 1, so two months ago was July 1 and one day before that was June 30 -- not May 31.

If I try the reverse:

dcalc today - 2m-1d

I get 2016-06-30

truthdoug commented 8 years ago

I just tried adding the d to the original query and got a better answer:

dcalc today - 2016-05-31 d

returns 93 days

MuppetGate commented 8 years ago

Yes, this having thought bout this a lot, I need to really keep the calculation in days, which is the root of the problem. I'll sort out a fix. Thanks for reporting it.

I shouldn't really be doing sums with months because they don't have an even number of days. Time to simply things a bit I reckon.