Issue with date format

I use Todaymacro for JanJo’s ToDo plug in (Mod of sticky todo plug in by stobot) for listing ToDos for today in today’s Journal tiddlers. Journal tiddlers (based on this code) have a field called journal-date with field value <<now "YYYY0MM0DD0hh0mm0ss000">>. Recently I started noticing an issue similar to the one mentioned here - Todo of a particular day after 17.00 hrs to 24.00 hrs of that particular day is listed in the next days list of ToDos.
@EricShulman Is there any way around for this?

Created and modified dates are saved as if they used the format [UTC]YYYY0MM0DD0hh0mm0sX000 meaning they are saved as utc times. During display they apply the local time zone. The easiest way is to set the journal-date using the same format.

2 Likes

This solved the issue. I used [UTC]YYYY0MM0DD0hh0mm0ss000. I guess the X in the code you shared [UTC]YYYY0MM0DD0hh0mm0sX000 was a typo. Thanks you @TW_Tones

Tony just had the characters swapped:

0XXX will give the milliseconds and always have the full amount of digits

1 Like
[UTC]YYYY0MM0DD0hh0mm0ss0XXX

This is the correct format rite?
https://tiddlywiki.com/#DateFormat

1 Like

I am using custom journal button with code given below

\whitespace trim
\define modjournalButton()
\whitespace trim
<$button tooltip={{$:/language/Buttons/NewJournal/Hint}} aria-label={{$:/language/Buttons/NewJournal/Caption}} class=<<tv-config-toolbar-class>> actions={{$:/core/ui/Actions/new-journal-mod}}>
<$list filter="[<tv-config-toolbar-icons>match[yes]]">
{{$:/images/bootstrap/journal-plus}}
</$list>
<$list filter="[<tv-config-toolbar-text>match[yes]]">
<span class="tc-btn-text">
<$text text={{$:/language/Buttons/NewJournal/Caption}}/>
</span>
</$list>
</$button>
\end
<<modjournalButton>>

Custom journal action code is here

\define get-tags() $(textFieldTags)$ $(tagsFieldTags)$
\whitespace trim
<$vars journalTitleTemplate={{$:/config/NewJournal/Title}} textFieldTags={{$:/config/NewJournal/Tags}} tagsFieldTags={{$:/config/NewJournal/Tags!!tags}} journalText={{$:/config/NewJournal/Text}}>
<$wikify name="journalTitle" text="""<$macrocall $name="now" format=<<journalTitleTemplate>>/>""">
<$reveal type="nomatch" state=<<journalTitle>> text="">
<$action-sendmessage $message="tm-new-tiddler" $param="Day" title=<<journalTitle>> tags=<<get-tags>> text={{{ [<journalTitle>get[]] }}}  journal-date=<<now "[UTC]YYYY0MM0DD0hh0mm0ss0XXX">> month={{{ [<journalTitle>split[,]rest[]] }}} link={{{ [<journalTitle>split[,]rest[]] }}} year={{{[<journalTitle>split[]last[4]join[]]}}} />
<$action-listops $tiddler={{{ [search:title<journalTitle>] }}} $tags="-template"/>
</$reveal>
<$reveal type="match" state=<<journalTitle>> text="">
<$action-sendmessage $message="tm-new-tiddler" $param="Day" title=<<journalTitle>> tags=<<get-tags>> text=<<journalText>>  journal-date=<<now "[UTC]YYYY0MM0DD0hh0mm0ss0XXX">> month={{{ [<journalTitle>split[,]rest[]] }}} link={{{ [<journalTitle>split[,]rest[]] }}} year={{{[<journalTitle>split[]last[4]join[]]}}} />
<$action-listops $tiddler={{{ [search:title<journalTitle>] }}} $tags="-template"/>
</$reveal>
</$wikify>
</$vars>

The problem I am having is that the time in the journal-date field of the journal tiddler lags behind the actual current time.

For example if I create a new journal tiddler now (current time being July 08, 12.33 AM), the time I am getting in the journal-date field is 20230707190408228 is of July 7. How to correct this lag ?

Press this pagecontrol button image in the menubar of the demo wiki to test it

The journalTitleTemplate format is using local time. However, the value of journal-date is being set to UTC time, rather than local time. Thus, the difference in the datetime is based on the offset between your local timezone and UTC time.

To have the journal-date field datetime value match the journal title datetime, remove the [UTC] from the <<now>> macro format parameter used to set the journal-date, like this:

<$action-sendmessage ... journal-date=<<now "YYYY0MM0DD0hh0mm0ss0XXX">>

-e

1 Like

I would leave the journal-date as UTC and change the to $:/config/NewJournal/Title
or similar for day Jounals, thus they are named in local time, and the jounal-date in UTC for more advanced date time handling accross time zones, especialy of you or the users can be accross data times.

  • If you want journals that include time concider a seperate mechanisium.
1 Like

Sorry for the delay in responding. I was busy with hospital duties for the last two days.

@EricShulman Thank you for the advice. Your suggestion works for me.

@TW_Tones I will use Eric’s suggestion now and will check whether there is any conflict with other customization in my wiki. I will revisit this thread in case I encounter any such issues.

1 Like