Thank you so much rabii for pointing out the problem!
If anybody else encounters the same issue, and is looking for the solution, I went with the most simple route and just added
PHP Code:
$stint = number\parseInt($st)
$stdate = datetime\addDays(date, -($stint-1));
Leave a comment: