Soren,

Implied in my reply (not very well) was the lack of Quotes, I think "[" and 
"]" would cause the string "format" to be misread. But as you say it is the 
need to wikify first;

\define now-timestamp() <<now "[UTC]YYYY0MM0DD0hh0mm0ssXXX">>
<$wikify name=input text="<<now-timestamp>>">
<$button set="!!created" setTo=<<input>> >
    Created Now
</$button>
</$wikify>

I have raised the possibility of a simpler way to annotate that a variable 
be wikified before use.

In your case, without wikify the the created field is being setTo= <<now 
[UTC]YYYY0MM0DD0hh0mm0ssXXX>>  <!-- the exact string un-wikified -->

In the following case we do not use a macro containing a macro so we need 
not wikify it first, the now macro is evaluated inline.
<$button set="!!created" setTo=<<now "[UTC]YYYY0MM0DD0hh0mm0ssXXX">> >
    Created Now
</$button>

Display {{!!created}}

Contains {{{ [all[current]get[created]] }}}

Regards
Tones

On Monday, 8 February 2021 at 12:58:23 UTC+11 Soren Bjornstad wrote:

> Tones,
>
> Thanks for your response, and sorry if I wasn't clear in my original post. 
> I have already solved the problem and am not looking for help on that (and 
> I agree that this is probably not a good way to use the created field in 
> most cases). I am instead wondering why I observed the unusual effect I did.
> On Sunday, February 7, 2021 at 5:38:20 PM UTC-6 TW Tones wrote:
>
>> Post script,
>>
>> In this case you will be making the created field lie, it will not be 
>> created date but button press date, I suggest using another field to store 
>> this date or use modified. It all depends on the logic you have behind it 
>> but I recommend using modified and created date as the system uses them 
>> because that information will always be true.
>>
>> Regards
>> Tones
>>
>>
>> On Monday, 8 February 2021 at 10:33:54 UTC+11 TW Tones wrote:
>>
>>> Try this 
>>>
>>>
>>>    - No need for the separate macro
>>>    - Place quotes around the format.
>>>
>>>
>>> <$button set="!!created" setTo=<<now "[UTC]YYYY0MM0DD0hh0mm0ssXXX">> >
>>>     Created Now
>>> </$button>
>>>
>>> Tones
>>>
>>> On Monday, 8 February 2021 at 04:29:43 UTC+11 Soren Bjornstad wrote:
>>>
>>>> While trying to create a button that resets the *created* date on a 
>>>> tiddler, I absentmindedly tried the following:
>>>>
>>>> \define now-timestamp() <<now [UTC]YYYY0MM0DD0hh0mm0ssXXX>>
>>>> <$button set="!!created" setTo=<<now-timestamp>>>
>>>>     Created Now
>>>> </$button>
>>>>
>>>> Now, I'm aware this snippet doesn't work and can't be expected to 
>>>> because the contents of *now-timestamp* aren't wikified when the macro 
>>>> call is being used as a transcluded widget-attribute value. I've since 
>>>> produced a correct version. However, I'm still confused about the result 
>>>> of 
>>>> clicking the button: the *created* field was set to 
>>>> NaNNaNNaNNaNNaNNaNNaN. I'm puzzled by what kind of calculation the 
>>>> *setTo* attribute of the $button widget is doing that's able to create 
>>>> a bunch of concatenated NaNs. I would have expected to simply get the 
>>>> literal text <<now [UTC]YYYY0MM0DD0hh0mm0ssXXX>> in the field.
>>>>
>>>> Is there something special about the *created* field in this regard?
>>>>
>>>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/bf5f90d4-7a2e-44c5-9595-97b29f41dd45n%40googlegroups.com.

Reply via email to