aboutsummaryrefslogtreecommitdiffstats
path: root/lib/logger.js
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2011-04-16 20:55:52 +0200
committerMatěj Cepl <mcepl@redhat.com>2011-06-05 14:44:43 +0200
commit4d29c8b4eb1f3e66da8d60fd1f42f3e4c06d2b39 (patch)
tree538b0ad2a635afce9db068ca6b8fb82ab50711bb /lib/logger.js
parent03eb77511381d3648bc4375d16e4b55cdb7dd0b3 (diff)
downloadbugzilla-triage-4d29c8b4eb1f3e66da8d60fd1f42f3e4c06d2b39.tar.gz
Generate better <title> for the timesheet.
Diffstat (limited to 'lib/logger.js')
-rw-r--r--lib/logger.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/logger.js b/lib/logger.js
index 19fabb5..7e0c516 100644
--- a/lib/logger.js
+++ b/lib/logger.js
@@ -79,13 +79,25 @@ exports.generateTimeSheet = function generateTimeSheet() {
};
function timeSheetRecordsPrinter(records) {
+ function leadingZero(n) {
+ // pads a single number with a leading zero. Heh.
+ var s = n.toString();
+ if (s.length === 1) {
+ s = "0" + s;
+ }
+ return s;
+ }
+
var commentBugRE = new RegExp("[bB]ug\\s+([0-9]+)","g");
// sort the records into temporary array
var tmpArr = [];
+ var today = new Date();
+ var todayStr = today.getFullYear()+"-"+leadingZero(today.getMonth()+1)+
+ "-"+leadingZero(today.getDate());
var outStr = '<!DOCTYPE html>' +
"<html><head>\n"+
"<meta charset='utf-8'/>\n"+
- "<title>Status report</title>\n</head>\n<body>\n" +
+ "<title>TimeSheet-"+ todayStr + "</title>\n</head>\n<body>\n" +
"<h1>TimeSheet</h1>\n";
for (var i in records) {