diff options
author | luxagraf <sng@luxagraf.net> | 2012-09-22 22:37:52 -0400 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2012-09-22 22:37:52 -0400 |
commit | 52d5613672758ac6c8ebffc7f33d94d47bde6180 (patch) | |
tree | 0b6e1fbc4ed013b2ba701dedeb39be9781ff8204 /app/lib/grappelli/media/js/timeparse.js | |
parent | efb623af0bcb47d510501c282e1326b11343a29c (diff) |
moved outside dependencies to virtualenv and dumped some unused apps out of lib
Diffstat (limited to 'app/lib/grappelli/media/js/timeparse.js')
-rw-r--r-- | app/lib/grappelli/media/js/timeparse.js | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/app/lib/grappelli/media/js/timeparse.js b/app/lib/grappelli/media/js/timeparse.js deleted file mode 100644 index 882f41d..0000000 --- a/app/lib/grappelli/media/js/timeparse.js +++ /dev/null @@ -1,94 +0,0 @@ -var timeParsePatterns = [ - // 9 - { re: /^\d{1,2}$/i, - handler: function(bits) { - if (bits[0].length == 1) { - return '0' + bits[0] + ':00'; - } else { - return bits[0] + ':00'; - } - } - }, - // 13:00 - { re: /^\d{2}[:.]\d{2}$/i, - handler: function(bits) { - return bits[0].replace('.', ':'); - } - }, - // 9:00 - { re: /^\d[:.]\d{2}$/i, - handler: function(bits) { - return '0' + bits[0].replace('.', ':'); - } - }, - // 3 am / 3 a.m. / 3am - { re: /^(\d+)\s*([ap])(?:.?m.?)?$/i, - handler: function(bits) { - var hour = parseInt(bits[1]); - if (hour == 12) { - hour = 0; - } - if (bits[2].toLowerCase() == 'p') { - if (hour == 12) { - hour = 0; - } - return (hour + 12) + ':00'; - } else { - if (hour < 10) { - return '0' + hour + ':00'; - } else { - return hour + ':00'; - } - } - } - }, - // 3.30 am / 3:15 a.m. / 3.00am - { re: /^(\d+)[.:](\d{2})\s*([ap]).?m.?$/i, - handler: function(bits) { - var hour = parseInt(bits[1]); - var mins = parseInt(bits[2]); - if (mins < 10) { - mins = '0' + mins; - } - if (hour == 12) { - hour = 0; - } - if (bits[3].toLowerCase() == 'p') { - if (hour == 12) { - hour = 0; - } - return (hour + 12) + ':' + mins; - } else { - if (hour < 10) { - return '0' + hour + ':' + mins; - } else { - return hour + ':' + mins; - } - } - } - }, - // noon - { re: /^no/i, - handler: function(bits) { - return '12:00'; - } - }, - // midnight - { re: /^mid/i, - handler: function(bits) { - return '00:00'; - } - } -]; - -function parseTimeString(s) { - for (var i = 0; i < timeParsePatterns.length; i++) { - var re = timeParsePatterns[i].re; - var handler = timeParsePatterns[i].handler; - var bits = re.exec(s); - if (bits) { - return handler(bits); - } - } - return s; -} |