diff options
author | Matěj Cepl <mcepl@redhat.com> | 2011-06-04 02:30:57 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2011-06-05 14:53:48 +0200 |
commit | ffa6d74ddbf28c7fb7be1ad473847807d0301eac (patch) | |
tree | d10ac4afcfeb053567db51462e9695badab875ee /data/lib/util.js | |
parent | 7509c91794f93a5b4445239429c2b918f771b543 (diff) | |
download | bugzilla-triage-ffa6d74ddbf28c7fb7be1ad473847807d0301eac.tar.gz |
Moving ahead ... storing the progress for future.
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. * |