[{"text":"/*\\\ntitle: $:/stobot/filters/adddays.js\ntype: application/javascript\nmodule-type: filteroperator\n\nBased on addsuffix\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.adddays = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tvar padded = title + \"0000000\";\n\t\tvar baseyear = padded.substr(0,4);\n\t\tvar basemonth = padded.substr(4,2);\n\t\tvar baseday = padded.substr(6,2);\n\t\tvar newdate = new Date(Number(baseyear), Number(basemonth)-1, Number(baseday), 0, 0, 0);\n\t\tvar newyear = Number(newdate.getFullYear());\n\t\tvar newmonth = Number(newdate.getMonth());\n\t\tvar newday = Number(newdate.getDate())+Number(operator.operand);\n\t\tvar finaldate = new Date(newyear, newmonth, newday, 0, 0, 0);\n\t\tvar datenumber = (finaldate.getFullYear()*10000) + ((finaldate.getMonth()+1)*100) + (finaldate.getDate());\n\t\tvar datestring = datenumber.toString();\n\t\tresults.push(datestring);\n\t});\n\treturn results;\n};\n\n})();\n","type":"application/javascript","title":"$:/stobot/filters/adddays.js","tags":"","module-type":"filteroperator","modified":"20211122115424929","created":"20211122112154278"}]