diff options
Diffstat (limited to 'data/lib/util.js')
-rw-r--r-- | data/lib/util.js | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/data/lib/util.js b/data/lib/util.js index 02cda2d..f30ddd5 100644 --- a/data/lib/util.js +++ b/data/lib/util.js @@ -68,7 +68,7 @@ function parseXMLfromString (inStuff) { * Get a bug no */ function getBugNo() { - var bugNoElem = document.forms.namedItem('changeform').getElementsByName("id")[0]; + var bugNoElem = document.forms.namedItem("changeform").elements["id"]; if (bugNoElem) { return bugNoElem.value; } else { @@ -214,6 +214,29 @@ function getISODate(dateStr) { } /** + * format Date object as ISO-8601 formatted date string + * + * @param d Date + * @return String with date formatted + * @url https://developer.mozilla.org/en/JavaScript/Reference\ + /Global_Objects/Date#Example.3a_ISO_8601_formatted_dates + * outputs something like 2009-09-28T19:03:12Z + */ +function ISODateString(d) { + function pad(n) { + return n<10 ? '0'+n : n + } + + return d.getUTCFullYear()+'-' + + pad(d.getUTCMonth()+1)+'-' + + pad(d.getUTCDate())+'T' + + pad(d.getUTCHours())+':' + + pad(d.getUTCMinutes())+':' + + pad(d.getUTCSeconds())+'Z'; +} + + +/** * Check whether an item is member of the list. Idea is just to make long if * commands slightly more readable. * |