diff options
author | Matěj Cepl <mcepl@redhat.com> | 2011-04-17 08:44:49 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2011-06-05 14:44:43 +0200 |
commit | 0ccc730b8cf0f66a8e9a15cc07b5b6613fc0e015 (patch) | |
tree | 3dece2704b161fce5ef4e963a18aec624a782ee9 /lib/logger.js | |
parent | 4d29c8b4eb1f3e66da8d60fd1f42f3e4c06d2b39 (diff) | |
download | bugzilla-triage-0ccc730b8cf0f66a8e9a15cc07b5b6613fc0e015.tar.gz |
Auch! Say NO to the copy&paste inheritance!
* leadingZero made into special function exported from xmlrpc module
(it is now able to accept either number of string as its parameter)
* added tests for leadingZero
Diffstat (limited to 'lib/logger.js')
-rw-r--r-- | lib/logger.js | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/lib/logger.js b/lib/logger.js index 7e0c516..d4c5dc9 100644 --- a/lib/logger.js +++ b/lib/logger.js @@ -79,21 +79,13 @@ 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 todayStr = today.getFullYear() + "-" + + xrpc.leadingZero(today.getMonth()+1) + "-" + + xrpc.leadingZero(today.getDate()); var outStr = '<!DOCTYPE html>' + "<html><head>\n"+ "<meta charset='utf-8'/>\n"+ |