Hi,

Here is my first attempt at a startup module for setting the fields "year" 
and "month" in "$:/_frd/state/calendar".

If does not work.

Any help welcome.

Thanks.

FrD

/*\
$:/_frd/startup.js
type: application/javascript
module-type: startup

Set up of current year and month

\*/
(function(){

/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";

// Export name and synchronous status
exports.name = "setcurrentyearandmonth";
exports.platforms = ["browser"];
exports.after = ["startup"];
exports.synchronous = true;

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);
}

})();



-- 
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/69307c6b-0945-4056-a627-62c4698d4c16%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to