Hmm. I just can’t wrap my head around this.
So, you have the JS function <<addDays 1>> already implemented, which would convert input “251118” to “251119”. So far so good.
Now you’re trying to call that in a procedure within a filter, but it does not work as you cannot pass the parameter into it, which, looking at the docs, only seems to be OK doing it the <<…>> way, which might not work inside the filter you’ve stated (I haven’t tried, as I don’t have a JS function lying around to play with).
If you plan to use addDays in a filter, you could instead make it a filter (like I did), which allows you to put it in there with a parameter, which probably can come from a function, like so:
"use strict";
exports.addDays = function(source, operator, options) {
var result = [];
source(function(tiddler, title) {
var inDate = …; // convert input string to a date
if (isNaN(inDate.valueOf())) {
result.push(`Not a date: ${title}`);
} else {
var n = $tw.utils.getInt(operator.operand, 0); // here's where you retrieve the parameter for the filter
result.push(…); // add calculation for the target date here, and push the result as a string
}
});
return result;
};
You could then use that in a filter directly ({{{ [……addDays[1]…] }}}).
Continuing your original route, something like this MAY work:
\define myProc(myOffset) <$text text="[prefix<addDays $myOffset$>]" />
<<myProc 1>>
(shows [prefix<addDays 1>])
…, though I’m not exactly sure why you have a procedure building part of a filter for something else, when you could work with <set>, or maybe directly with a filter instead. Maybe if you tell a bit more about your use case I could try come up with a less guesswork-y answer, as I’m (as you may have guessed already
) fishing a bit in the dark here.
Hope that helps at least somehow?