Code:
var t1 = 1340067920000;
console.log('t1: ' + (new Date(t1)).toLocaleString());
console.log('now: ' + (new Date()).toLocaleString());
console.log('relative: ' + goog.date.relative.format(t1));
generates in my timezone:
t1: Tuesday, June 19, 2012 3:05:20 AM
now: Friday, June 22, 2012 1:27:12 PM
relative: 4 days ago
I think that it should generate:
...
relative: 3 days ago
To repeat the problem in another timezone you will need to choose another
timestamp.
I think the problem is in 2 lines of goog.date.relative.format():
delta = Math.floor((now + offset) ...
Math.floor((dateMs + offset) ...
There should be
delta = Math.floor((now - offset) ...
Math.floor((dateMs - offset) ...
Original issue reported on code.google.com by Li...@tibosoftware.com on 22 Jun 2012 at 11:51
Original issue reported on code.google.com by
Li...@tibosoftware.com
on 22 Jun 2012 at 11:51