Fantastical add event and reminder

Anyone else have this error for the add fantastical event and reminder action?

Script Error: ReferenceError: Can’t find variable: chrono
Line number: 19, Column 38

thanks!

Can you specify which action this is? There are no actions in the directory called “fantastical event and reminder”, and there are twelve that contain the word “Fantastical”.

The best way to specify an action is to provide a link to it in the directory.

Ah yes of course. I didn’t even think and just assumed,

Thanks!

Okay, somewhat ironically, neither of those two different actions actually use Fantastical - their aim being to give a Fantastical-like parsing experience without using Fantastical.

I’ve just tried a quick test of both and they work fine for me. A new matching reminder and event were created.

A lack of definition for chrono would seem to suggest the first action step that embeds the chrono.min.js JavaScript library has been removed as that looks to define chrono for use by the second script Step; which I believe is the one reporting the error.

Can you try deleting one of the actions, reinstalling it from the directory, and trying it again?

If you get the same error, can you share a link to your own copy of the action, and your draft content you are processing? From there we can try and reproduce the issue based on exactly what you have in place.

Interesting, i just tried re-tried and still the same issue. I tried it with both the event and reminder parsers.
Drafts version 35.0.2

I just shared it there - I hope we can delete after as this is simply a pure copy of it.
The draft I am trying run just has the phrase “transfer money for gift”
thanks for your help!

I removed the old actions, installed your copy, and ran it on the following.

transfer money for gift

The result was a successful run and a new reminder created.

I then checked my Drafts version. My iPhone was still on the Testflight version, which was slightly behind the App Store version. An issue I had on my Mac a couple of days ago that Greg kindly highlighted to me - I hadn’t got round to updating my phone until this point.

I have now updated to the app store version, 35.0.2, and now I get the same error as you.

So somethings changed with the most recent version of Drafts.

I tried combining the script steps in case it was a step-scope issue, but that didn’t have any effect other than the line number changing.

@agiletortoise, is there anything you are aware of in v35 that could cause this?

1 Like

Yes, there is a change affecting the way the chronos library is initializing itself. I’ll have to think about how I want to handle that moving forward, but you can fix by removing an if statement from the library in your version of the action. The specific bit to remove appears at line 28, character 164 in the minimized script in the first step of the action:

if(typeof window!=="undefined"){g=window}else 

Here’s a fixed version of the whole action

2 Likes

Hi Greg, I’m not sure I know enough to understand what the problem is, but I’m happy to fix it if you point me in the right direction.

Should I just remove the if statement from the published version as you suggest above?

Perhaps. I’ll probably rollback the change that caused this in the next update because I can potentially see it causing problems for other browsify’d javascript libraries that are trying to sniff out the environment…but removing the line mentioned above will still work in either case if you want to push those updates.

1 Like

OK, if the next update will fix it, I will hold off for now. Thanks.

One of the prime reasons I use fantastical is that it allows me to set a zoom meeting simultaneously in the same appointment.

Any chance this could be made to do that as well? I think that would put an end to fantastical if it could.