Jump to content

Yet another date calculator


Recommended Posts

Thank you for the quick and nice update!

 

Would you consider to make dcalc today +30d and dcalc +30d give the same result?

 

Mmmm. That would involve a rather specialist case for the parser which I try to avoid.

 

What I might do is abbreviations for the more common functions, so you can do something like this:

 

dcalc *

 

for the current date, and then you can do:

 

dcalc *+60d

 

to add 60 days to the current date.

Link to comment

Yet another update!

 

First off, I've added a few abbreviations that should make it a lot easier to get at the more common functions.

 

dcalc *

for today's date.

 

dcalc <

for yesterday

 

dcalc >

for tomorrow

 

dcalc &

for the current time

 

dcalc #

for the time and date

 

And of course you can combine these with date and timespan functions, but they may be a little hard to read.

 

dcalc > + 1d

 

is the day after tomorrow.

 

I've also added a few other functions.

 

dcalc pancake day (guess what that is)

 

dcalc lent (the start of Lent)

 

dcalc mlk (Martin Luther King day)

Link to comment

Hi,

 

I am not sure if I am doing this right or if this is a bug.

 

I entered below query and got response 02-18-2015:

dcalc 02-28-2015 - 10d

However when I do below I still get the same response 02-18-2015:

dcalc 02-28-2015 - 10d x weekends

The same would work for "+" sign and the issue seems to be with "-" calculations only.

 

Another things is, I have a situation where I would want to calculate X number of working days before given future date so that I could setup a reminder accordingly. For something like below:

dcalc 03-15-2015 - 10d x weekends

I would expect to get 03-02-2015 in return and not 03-05-2015 as I need 10 work days before the entered date. Is this something that you think is logical and possible?

 

Thanks!

 

 

 

 

 

 

 

dcalc 03-01-2015 + 10d x weekends

Link to comment

Flying visit! Sorry!

 

 

Hi,

 

I am not sure if I am doing this right or if this is a bug.

 

 

 

 

It's a bug. The fix is now on Packal

 

 

Could you add "mudda" as a synonym for "mom"? Mother's Day in Germany is the same as in the US.

 

 

I most certainly can!

 

dcalc mutter 

 

will give Mother's Day in Germany. I also noticed that I've calculated Mother's Day for US (and so Germany) incorrectly: it is the second Sunday in May, not the third, as I previously thought.

Link to comment
  • 1 month later...

Just want to say thanks for this awesome workflow!

 

I was trying to edit the anniversaries list and couldn't get it to work. I did some digging and found a few bugs in code with passing the date format in set_anniversary.py (calls to convert_date_time()) and macros_parser.py (call to super constructor). The methods do not accept the date format parameter as it is retrieved from the settings parameter. For example (line 21 in set_anniversary.py):

date_time, output_format = convert_date_time(command.dateTime, date_mapping['date-format'], wf.settings)

date_mapping['date-format'] should be removed. Just thought I'd let you know. Thanks again!

Edited by tone
Link to comment

Just want to say thanks for this awesome workflow!

 

I was trying to edit the anniversaries list and couldn't get it to work. I did some digging and found a few bugs in code with passing the date format in set_anniversary.py (calls to convert_date_time()) and macros_parser.py (call to super constructor). The methods do not accept the date format parameter as it is retrieved from the settings parameter. For example (line 21 in set_anniversary.py):

date_time, output_format = convert_date_time(command.dateTime, date_mapping['date-format'], wf.settings)

date_mapping['date-format'] should be removed. Just thought I'd let you know. Thanks again!

 

Thanks for pointing this one out.

 

Seems I forgot to check in some changes. I'll fix it over the weekend.

Link to comment
  • 5 months later...

Hey Brilliant workflow.

I am very excited about decal today + 10d x weekends, but it doesn't do what I expect.  I want to know when I can expect something to be done that takes 10 working days to do.   Excluding weekends in a today + days command seems to reduce the time instead of extend it.  Is that a bug?  Or am I thinking about it wrong?

Link to comment

Hey Brilliant workflow.

I am very excited about decal today + 10d x weekends, but it doesn't do what I expect.  I want to know when I can expect something to be done that takes 10 working days to do.   Excluding weekends in a today + days command seems to reduce the time instead of extend it.  Is that a bug?  Or am I thinking about it wrong?

 

Mmmm. Yes, I see what you're saying.

 

This function was only supposed to work with date substractions:

 

dcalc today - 301.10.2015 x weekends d

 

But I can see that I used the same maths for date additions (as you are trying to do), which probably isn't what is needed.  I'll have a think about it. At the moment I'm working on the help page, so if I do it then it'll probably be the next thing on the list.

Edited by MuppetGate
Link to comment
  • 4 weeks later...
  • 1 month later...

Merry Christmas folks!

 

And a new version of the date calculator.

 

The only noticeable change is that I've added a help page, accessed from a website. Not ideal, and I'll roll it into the workflow once I've finished it completely.

 

Accessed by entering 

 

dcalchelp

 

on the Alfred command line. The new version can be found in the usual place (Packal).

 

Though, I'm not sure it'll see much use, the exclusion function now works with date addition calculations. It's a little bit weird, but if you do enter something like this:

 

dcalc today + 60d

 

then you'll get the date sixty days from now. But if you do this:

 

dcalc today + 60d exclude weekends

 

will push out the date further to take account of weekends. The idea is that if you want to know how long you have to complete a project, then you might want the +60d to take into account the fact that you don't work on weekends. 

 

It's a bit of an experiment!

 

http://www.packal.or...date-calculator

Link to comment

Hello,

 

 

I used sometimes your workflow: very useful!

 

I don't know why, but today it doesn't work... "invalid command".

 

I don't remember to change something.

 

 

Not sure why this happening. I'm not seeing it here.

 

What are you typing into Alfred exactly? I've entered 

 

dcalc today

 

and it seems to work fine. 

Link to comment
  • 3 weeks later...

UPDATE:   SOLVED

 

I added an additional Applescript output from the dcalc script filter with a shift modifier to open Fantastical to the calculated date, with the following very simple script:
on alfred_script(q)
  	tell application "Fantastical"
		parse sentence (q)
	end tell
end alfred_script

This makes for a nice quick way to quickly calculate a date and immediately start adding an event or checking what's on my calendar for that date.

 

Thanks for this excellent workflow.

Would someone kindly explain to me how to make the above-mentioned output addition, to send a date to Fantastical?

I have created a script output. Language osascript (AS). Added a Shift modifier.

But I am not sure how to include the above script. If I simply paste this into the script output, it does nothing.

I also tried having

q="{query}"

as the first line, in case the `q` in the script needs to be defined as the query, but that also didn’t help.

 

Thank you...

 

Jonathan

Edited by jenz
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...