Problems with date math in Taskpaper to Omnifocus


#1

I am using Shortcuts to automate generation of projects I receive via email. The emails have a relatively consistent format, so I parse out the relevant text and dates and build Taskpaper text, which is then pushed into Omnifocus 3.

However, the date math isn’t working for me:
- Submit recommendation @parallel(false) @autodone(false) @tags(👥 : Jane) @due(9/21/18+30d 17:00)

In OF, this date translates to 9/22/18 at 9:00pm. Should be 10/21/18 at 5:00pm.

I can just do the math in Shortcuts but I was hoping to use the more elegant date math in OF. Thanks in advance!


#2

This formatting will work: @due(9/21/2018 17:00 +30d)

Essentially, define the hard time first, then add the days. Also, using yyyy seems to matter.

Cheers,

ScottyJ


#3

Thank you! I should have tried that! Works like a charm now!

What problems have you seen with a 2-digit month (I’m assuming that might be “medium” date format in Shortcuts.) So far, a 2-digit month seems to be working for me in this shortcut.


#4

I tried using a 2 digit year in the format above and obtained an unexpected result (it was dating the year forward?). I have have typo’d though. And I haven’t had a lot of coffee.

Glad this is working, though!

ScottyJ


#5

Has this changed? When I try to follow the same format, it seems to not work. I’m wanting to make a number of tasks based on a start date. It does work if I don’t care about the time that the task is due at. It just keeps defaulting to midnight. An example would be:

- Task 1 @due(10/09/2018 21:00 +3d)

but it also seems to not work using any of the following:

@due(10/09/18 21:00 +3d)
@due(10/09/2018 +3d 21:00)

I was trying to problem solve as well, thinking maybe it was a problem with the script I’m using (I’m using @rosemaryjayne OF Taskpaper Group which is awesome!). I also tested it by just dragging the text from Drafts to Omnifocus. Same result. Am I doing something wrong?


#6

As an aside, this looks like US date format. To be able to specify rest-of-the-world :-) format what do I do?


#7

I’m sure this has worked in the past. I emailed it in, because I’d like to make sure this works as well!

ScottyJ


#8

The format appears to have changed. I have just built an automation which uses the following format and seems to work fine

  • Task 1 @due(Tomorrow+3d 21:00)

Basically,do the date maths before adding the time element to the end


#9

Actually, I spoke too soon. It retained the time format but the date maths wasnt working as expected. I have resorted to doing the date maths in the calling Siri Shortcut now, setting different variables names, and just using “[variable name] 17:00” to force the correct due time too.

I think my use of magic variables to pick up the output of “Adjust Date” may have contributed to the issues as the output variables default to Text for some reason too…would have made sense to output a date of same format as input IMHO


#10

I’m experiencing a similar problem. I want to set a date as a variable at the start of a Shortcut and then back-date tasks from that date within the created project.

My current syntax is @due(<<Date Variable>> - 3d) for a task there days before the final due date. Where <<Date Variable>> was converted to 8601 Format with time in the prior step.

The shortcut just keeps out putting that sub-task as being due on the final date represented by the Date Variable. Any ideas on how to get the math to work?


#11

I have the same issue with a Shortcut script - I have a “leaving home on a trip” TaskPaper template that has simple date arithmetic to defer until the day before departure, and the defer date always ends up being the date that was entered. The “-1d” seems to be ignored.