Strange effect when using tm-new-tiddler

107 views
Skip to first unread message

Ivan Aparicio

unread,
Jan 8, 2017, 9:33:52 AM1/8/17
to tiddl...@googlegroups.com
I've created a button in TW5 that will allow me to make an entry in a dream diary. Here's the code:

<$button>
  ''Dream''
  <$action-sendmessage
  $message="tm-new-tiddler"
  $template=""
  title=<
<now "DDth of MMM YYYY- Dream">> tags="Journal [[Dream]]"/>
</$button>


The strange thing, is that when I click the button, the word 'Dream' in the title shows up as 'Drepm'!

I have no idea why - does anybody have any ideas?

Tobias Beer

unread,
Jan 8, 2017, 9:55:22 AM1/8/17
to tiddl...@googlegroups.com
Hi Ivan,
 
The strange thing, is that when I click the button, the word 'Dream' in the title shows up as 'Drepm'!

Well, the sequences am / pm are valid date formating characters.  ;)

Try:

<$vars prefix=<<now "DDth of MMM YYYY, hh mm ss">> title="$(prefix)$-Dream">

<$button>
  ''Dream''
  <$action-sendmessage
  $message="tm-new-tiddler"
  $template=""
  title=<<title>> tags="Journal [[Dream]]"/>
</$button>
</$vars>

However, notice that the date being used is the date when the button was rendered, not the date when it was clicked!
Atm, I am not sure how one could make it so it would use the date / time of clicking the button.

Wait, the above problem is less "dramatic", since using the now macro forces the widget to refresh at every action you do on your machine.
However, should you close the lid of your laptop, only to open it up tomorrow, and the first thing being to hit that button, you'll find that it will use yesterday's date.
To make it use today's date, do anything that refreshes anything, e.g. switch a tab, click a link, search something.

Best wishes,

Tobias.

CL

unread,
Jan 8, 2017, 9:59:19 AM1/8/17
to tiddl...@googlegroups.com
Hi Ivan

Check
http://tiddlywiki.com/#DateFormat

that 'am' at the end of 'dream'
has been interpreted as am/pm indicator

CL

PMario

unread,
Jan 8, 2017, 10:27:33 AM1/8/17
to TiddlyWiki
Hi folks,

There's a related open issue at github: https://github.com/Jermolene/TiddlyWiki5/issues/1553 with a little bit of discussion between me and Jeremy. ... We couldn't find a good solution yet. So a new pair of eyes may be of help here ;)

The goal would be to solve the problem at the core level ... if possible.

have fun!
mario

Jeremy Ruston

unread,
Jan 8, 2017, 1:10:55 PM1/8/17
to tiddl...@googlegroups.com
Hi Tobias

However, notice that the date being used is the date when the button was rendered, not the date when it was clicked!

You can fix this by using an `actions` attribute with the button widget, rather than embedded action widgets.

Best wishes

Jeremy.

Ivan Aparicio

unread,
Jan 8, 2017, 4:52:27 PM1/8/17
to TiddlyWiki
Guys,

Really good stuff - Tobias' code fixed my problem! For a dream diary, this is more than adequate, as I don't need the timestamp to be accurate to the second. I normally only have one dream to record per day!

Thanks again.

Ivan

Tobias Beer

unread,
Jan 9, 2017, 6:32:46 AM1/9/17
to TiddlyWiki
Hi Ivan,

I extended my example for a custom Journal button to cover your issue as well:


Best wishes,

Tobias.
Reply all
Reply to author
Forward
0 new messages