The problem with the Journal button is that it only makes one entry per day, right?
Are you using some other logging/recording macro or tool kit?
exports.formatDateString = function(date,template) {
etc.
<$set name="date" value="201903170000000">
<$view tiddler=<<date>> field="title" format="date" template="[UTC] DDD DDth MMM YYYY"/>
<$set>
Good find. So we can say to feed a value into the view template for formatting you set the tiddler to that value?
this may be a way to feed other variables into other widgets that do not accept variables.
Good hack tip.
Regards
Tony
The important bit is to set the title to the variable.
\define new-date(format:"[UTC]YYYY0MM0DD000000000")
<$wikify name="date" text="{{!!yyyy}}{{!!mm}}{{!!dd}}0000000" >
<$view tiddler=<<date>> field="title" format="date" template="$format$"/>
<$wikify>
\end
\define new-date-vars(format:"[UTC]YYYY0MM0DD000000000")
<$wikify name="date" text="<<year>><<month>><<day>>0000000" >
<$view tiddler=<<date>> field="title" format="date" template="$format$"/>
<$wikify>
\end
\define new-date-state(format:"[UTC]YYYY0MM0DD000000000")
<$wikify name="date" text="{{year}}{{month}}{{day}}0000000" >
<$view tiddler=<<date>> field="title" format="date" template="$format$"/>
<$wikify>
\end
;Constructed date
:Default serial <<new-date>>
:Selected format <<new-date format:"[UTC] DDD DDth MMM YYYY">>
;Time
:<<new-date format:"0hh:0mm">> Shows your time offset because input time is 00:00 ?
:<<new-date format:"[UTC]0hh:0mm">> Assumes date is a UTC time
;Constructed date from variables
<$vars
year=2013
month=12
day=15
>
:Default serial <<new-date-vars>>
:Selected format <<new-date-vars format:"[UTC] DDD DDth MMM YYYY">>
</$vars>
;Constructed date from "state tiddlers"
::Default serial <<new-date-state>>
:Selected format <<new-date-state format:"[UTC] DDD DDth MMM YYYY">>
\define new-date(format:"[UTC]YYYY0MM0DD000000000",source:"<<year>><<month>><<day>>0000000")
<$wikify name="date" text="$source$" >
<$view tiddler=<<date>> field="title" format="date" template="$format$"/>
<$wikify>
\end
;default from variables
<$vars
year=2001
month=01
day=01
>
:Default serial <<new-date>>
:Selected format <<new-date format:"[UTC] DDD DDth MMM YYYY">>
;I do not know how to pass the source `"<<year>><<month>><<day>>0000000` yet
</$vars>
;From fields
:State <<new-date source:"{{!!yyyy}}{{!!mm}}{{!!dd}}0000000">>
:Selected format <<new-date format:"[UTC] DDD DDth MMM YYYY" source:"{{!!yyyy}}{{!!mm}}{{!!dd}}0000000">>
;From state
:State <<new-date source:"{{year}}{{month}}{{day}}0000000">>
:Selected format <<new-date format:"[UTC] DDD DDth MMM YYYY" source:"{{year}}{{month}}{{day}}0000000">>
;From mixed (Without variables)
:State <<new-date source:"2017{{!!mm}}{{day}}1200000">>
:Selected format <<new-date format:"[UTC] DDD DDth MMM YYYY" source:"2017{{!!mm}}{{day}}1200000">>
<<now "[UTC]YYYY0MM0DD0hh0mm0ssXXX">>
so the UTC time is saved and the View widget returns the local time unless we ask for UTC\define now-serial-date() <<now "YYYY0MM0DD0hh0mm0ssXXX">>
\define utc-now-serial-date() <<now "[UTC]YYYY0MM0DD0hh0mm0ssXXX">>
\define this-hour-0hh() <<now "[UTC]0hh">>
\define this-hour-here-0hh() <<now "0hh">>
\define this-day-0dd() <<now "[UTC]0DD">>
\define this-month-0mm() <<now "[UTC]0MM">>
\define this-year-yyyy() <<now "[UTC]YYYY">>
;Despite being easy to read the following dates will NOT be sorted correctly, accross years
:local time now: <<now "DDth mmm YYYY 0hh:0mm:0ss">>
:UTC time now: <<now "[UTC]DDth mmm YYYY 0hh:0mm:0ss">>
:<<now-serial-date>>
:<<this-hour-0hh>>
:<<this-hour-here-0hh>>
:<<this-day-0dd>>
:<<this-month-0mm>>
:<<this-year-yyyy>>
;Use wikify to save the date value not the content of the macro
<$wikify name=now-date text=<<now-serial-date>> >
<$button set="!!saved-date" setTo=<<now-date>> >
Set to Now
</$button>
</$wikify>
<$wikify name=now-date text=<<utc-now-serial-date>> >
<$button set="!!saved-date" setTo=<<now-date>> >
Set to Now UTC
</$button>
</$wikify>
;As stored saved-date {{!!saved-date}},
:Template without UTC <$view field=saved-date format=date template="YYYY0MM0DD0hh0mm0ssXXX"/> OR <$view field=saved-date format=date template="DDth mmm YYYY 0hh:0mm:0ss"/> timezone applied to saved-date, so Assumes time is UTC and you want local time.
:Template With UTC <$view field=saved-date format=date template="[UTC]YYYY0MM0DD0hh0mm0ssXXX"/> OR <$view field=saved-date format=date template="[UTC]DDth mmm YYYY 0hh:0mm:0ss"/> Does not apply timezone to saved-date , thus treats as if the field is UTC and you want UTC
;In built dates treated specialy, translated to local time
:Serial Date <$list filter="[all[current]get[modified]]"></$list>, Modified {{!!modified}}
:Serial Date <$list filter="[all[current]get[created]]"></$list>, Created {{!!created}}
Mark,
<<new-date source:"{{!!yyyy}}{{!!mm}}{{!!dd}}0000000" format:"YYYY0MM0DD0hh0mm0ss0XXX">>
<<new-date source:"{{!!yyyy}}{{!!mm}}{{!!dd}}0000000" format:"[UTC]YYYY0MM0DD0hh0mm0ss0XXX">>