Time formatting boost. God damn, that was easy.

This commit is contained in:
Nicolas Stepien 2011-10-11 14:32:42 +02:00
parent e43d6d4431
commit 2e43059f3e
2 changed files with 3 additions and 14 deletions

View File

@ -2203,16 +2203,12 @@
return g.callbacks.push(Time.node);
},
node: function(root) {
var day, hour, min, month, node, posttime, time, year, _, _ref;
var node, posttime, time;
if (root.className === 'inline') {
return;
}
node = (posttime = $('.posttime', root)) ? posttime : $('span[id]', root).previousSibling;
_ref = node.textContent.match(/(\d+)\/(\d+)\/(\d+)\(\w+\)(\d+):(\d+)/), _ = _ref[0], month = _ref[1], day = _ref[2], year = _ref[3], hour = _ref[4], min = _ref[5];
year = "20" + year;
month -= 1;
hour = g.chanOffset + Number(hour);
Time.date = new Date(year, month, day, hour, min);
Time.date = new Date(Date.parse(node.textContent) + g.chanOffset * HOUR);
time = $.el('time', {
textContent: ' ' + Time.funk(Time) + ' '
});

View File

@ -1669,14 +1669,7 @@ Time =
node: (root) ->
return if root.className is 'inline'
node = if posttime = $('.posttime', root) then posttime else $('span[id]', root).previousSibling
[_, month, day, year, hour, min] =
node.textContent.match /(\d+)\/(\d+)\/(\d+)\(\w+\)(\d+):(\d+)/
year = "20#{year}"
month -= 1 #months start at 0
hour = g.chanOffset + Number hour
Time.date = new Date year, month, day, hour, min
#XXX /b/ will have seconds cut off
Time.date = new Date Date.parse(node.textContent) + g.chanOffset*HOUR
time = $.el 'time',
textContent: ' ' + Time.funk(Time) + ' '
$.replace node, time