<$action-setfield .../>
/*\
$:/_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);
}
})();
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);
}
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));
};
$tw.wiki.setText("$:/_frd/state/calendar","year","",year);
$tw.wiki.setText("$:/_frd/state/calendar","month","",month);
forgot to click the "add" button when I added the module-type field (set to startup)