Hi Frd,

I have no experience with startup modules, but the core has a 
$tw.utils.pad(value) method.

So this...

exports.startup = function() {
>     var date= new Date();
>     var year=date.getFullYear();
>     var month=zeropad(date.getMonth() +1);
>     $tw.wiki.setText("$:/_frd/state/calendar","year","",year);
>     $tw.wiki.setText("$:/_frd/state/calendar","month","",month);
> };
>
> function zeropad(num) {
>     var s= "0"+num.toString()+"0";
>     return s.slice(-3,-1);
> }
>

Could just be...

exports.startup = function() {
    var date= new Date();
    $tw.wiki.setText("$:/_frd/state/calendar", "year", undefined, date.
getFullYear());
    $tw.wiki.setText("$:/_frd/state/calendar", "month", undefined, $tw.utils
.pad(date.getMonth()+1));
};

I can imagine that using undefined rather than "" as the third parameter to 
setText() perhaps makes a difference.

Best wishes,

— tb

-- 
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/f98327a4-a521-4cc1-b304-7ad2933ca67b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to