I have created a button that allows me to create a subtiddler for the current tiddler, and can be additionally customised by adding fields to a tiddler. On one tiddler I have added a field so that the created subtiddler is created with the current date, like this: MyTiddler/2022-01-10. This is similar to the code for the new journal button.
However, it will often show the wrong date and require a refresh to show the correct one. For example when I clicked the button today it used yesterday’s date. I then clicked the new journal button and it used the correct date, so I am assuming it is a problem with how I’ve implemented the button, but I’m not sure what the issue is.
I’m in the UTC timezone, and I clicked the button at around 7:30 pm.
That being said, the new journal button used the correct date, and I’ve had the same problem at various times throughout the day, so I think it might be something else.
The cause of your problem is that the target tiddler title, <<currentPrefix>>, is computed before the $button is rendered AND the $action-sendmessage $message="tm-new-tiddler" is specified inline in the body of the $button. To get the result you want, you need to compute the title when the $button is clicked, which may be at a much later moment in time.
To achieve this, use the actions=... parameter in the $button widget, like this: