Can I create an external tool with parameters using LTI variable substitutions with arithmetic operations?
For example, if we wanted to set a date via LTI substitution, could we set it to something like:
$Canvas.assignment.dueAt.iso8601 + 86400
(where 86400 is the number of seconds in 24 hrs)
I can't see anything documented on this, and I'm thinking it's probably not possible but I know that sometimes there are unexpected solutions, such as the one pklove was able to help us with on another LTI variable substitution question we had (https://community.canvaslms.com/thread/23903-lti-variable-replacement-as-part-of-a-custom-field )
Thanks for any advice
Like you, I haven't seen anything like this. I went and checked the Canvas source code for the /lib/lti/variable_expander.rb file and didn't see any kind of user-specified arithmetic operators in there.
Canvas would expect that functionality that would be built into the LTI itself. They give you the due date, it's up to you to add 1 on your end if you need. That philosophy has been pretty consistent with Canvas, they give the UTC code of what is in their databases and it's up to you to do any calculations you need.
Although I know it's just an example, it probably wouldn't work anyway. The iso8601 representation is normally a string and not a number like the number of seconds since some epoch (Jan 1, 1970). It wouldn't know how to add a value to it. There are helper libraries that do conversions on dates, but using them in this case is inconsistent with Canvas' approach in sticking with UTC time for everything.
On the other hand, if an LTI needs to give one extra day's grace, then there should be an option in the LTI asking for that and then do the calculations itself.
Thanks for taking the time to look in the source code, that's much appreciated.
And I take your point re doing math operations on ISO8601 formatted dates and potential time zone issues. I'd done some testing of this in a ruby environment, and it looked to me as though the addition operation incremented the date by one second, but it could have been being handled by helper libraries.