Jump to content
MuppetGate

Yet another date calculator

Recommended Posts

 

 

First up, the requested expansion to the exclude functionality. As well as working with timespans, you can now use it on functions that return absolute dates.

 

 

Awesome!!! Thank you!!! :D

Share this post


Link to post

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.

Share this post


Link to post

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)

Share this post


Link to post

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

Share this post


Link to post

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.

Share this post


Link to post

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

Share this post


Link to post

Thanks for this great workflow! Could you also include a help command, which shows each command example and a short description? Or a static html file which holds the docu which can be open by the help command?

Share this post


Link to post

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.

Share this post


Link to post

Thanks for this great workflow! Could you also include a help command, which shows each command example and a short description? Or a static html file which holds the docu which can be open by the help command?

 

A bit short on time, but I'll put it on the list.  :)

Share this post


Link to post

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?

Share this post


Link to post

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

Share this post


Link to post

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

Share this post


Link to post

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.

Share this post


Link to post

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. 

Share this post


Link to post

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

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...