diff options
author | Matěj Cepl <mcepl@redhat.com> | 2011-04-16 20:55:52 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2011-04-16 20:55:52 +0200 |
commit | 2facce309d8fbacc7364ff50df30aded4047181e (patch) | |
tree | ce0291bd4481b46e381db748d411ddeecdbfa30a /lib/logger.js | |
parent | 76125263d227d333c30c6a7e6e6ebd4cfe6abc79 (diff) | |
download | bugzilla-triage-2facce309d8fbacc7364ff50df30aded4047181e.tar.gz |
Generate better <title> for the timesheet.
Diffstat (limited to 'lib/logger.js')
-rw-r--r-- | lib/logger.js | 14 |
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) { |