That code looks nice and clean, and might do everything Antaeus wants ... EXCEPT that it can't (or at least I don't think it can) be used inside a button the way he wants.
The solution is to rewrite the javascript code so that it accepts values from <$set> variables outside instead of parameters. Someone could eliminate the parameters and instead put these lines just inside the run() function: var format = this.getVariable("format") ; var delay = this.getVariable("delay") ; var ts = this.getVariable("ts") ; I haven't tried it though. If anyone tries this, they should be sure to back up their TW. A single mistake can cause the red-block-of-javascript doom to pop up. Mark On Tuesday, October 6, 2015 at 9:58:14 PM UTC-7, Andrew wrote: > > How about > http://t5a.tiddlyspot.com/#%24%3A%2Fplugin%2Fajh%2Ftiddlytime%2FDateTime.js > > Happy Connecting. Sent from my Sprint Samsung Galaxy S® 5 > > > -------- Original message -------- > From: Antaeus Feldspar <afel...@gmail.com <javascript:>> > Date: 10/06/2015 7:13 PM (GMT-07:00) > To: TiddlyWiki <tiddl...@googlegroups.com <javascript:>> > Subject: Re: [tw] [TW5] How to create a button that replaces a field value > based on the current field value? > > Actually, perhaps I should share what my macro will do - I went looking to > see if there was an existing plugin that handled such things, and didn't > find one, but that could be just because I wasn't looking in the right > places. > > My macro will take a 17-character string as used in a Date field as its > first parameter, and as its second, a string indicating an amount of time > to increment it ("1d", for instance, would be one day.) It will calculate > and return the incremented date. With being able to read, modify, and > write back a date values, I can create easy "reschedule" buttons for task > tiddlers. > > To tell the truth, there are some terrific JS libraries that do all of > that and much more, and I was hoping there would be a simple way they might > be incorporated into TW5, but if there is, I haven't found documentation > for it. Is there such a way? Or has someone already created awesome > date-manipulation plugins? > > -- > You received this message because you are subscribed to the Google Groups > "TiddlyWiki" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to tiddlywiki+...@googlegroups.com <javascript:>. > To post to this group, send email to tiddl...@googlegroups.com > <javascript:>. > Visit this group at http://groups.google.com/group/tiddlywiki. > To view this discussion on the web visit > https://groups.google.com/d/msgid/tiddlywiki/b6786561-3bd5-4f31-876c-ef4185e9e9e1%40googlegroups.com > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+unsubscr...@googlegroups.com. To post to this group, send email to tiddlywiki@googlegroups.com. Visit this group at http://groups.google.com/group/tiddlywiki. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/4ed62f80-a848-4488-8ec3-36821c26bf9c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.