From 2facce309d8fbacc7364ff50df30aded4047181e Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Sat, 16 Apr 2011 20:55:52 +0200 Subject: Generate better for the timesheet. --- lib/logger.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'lib/logger.js') 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\n\n\n" + + "TimeSheet-"+ todayStr + "\n\n\n" + "

TimeSheet

\n"; for (var i in records) { -- cgit