defunkt/resque — Issue #475: Broken relative dates in resque-web's 'worker' pages
Author: jperville
Created: 2011-12-12 07:05:00+00:00
State: open

I have noticed that some relative dates displayed in resque-web are still broken (they display "NaN days ago" in my exotic timezone, at least with Firefox 8 and MSIE9).

The issue #297 fixed some of these issues, but I found more attributes that exhibit the same problem.

For example, here is the html displayed by firebug when I inspect the summary of a worker at url http://server/resque/workers/dev:22557:*

```html

2011-12-11 13:55:37 +0630
NaN days ago

```

My timezone and resque version (also displays the problem on git head) :

```sh
julien@dev:~$ gem list resque
resque (1.19.0)
julien@dev:~$ date
Sun Dec 11 20:38:12 MMT 2011
julien@dev:~$
```

Some system information :

```
#!sh
julien@dev:~$ irb
irb(main):001:0> Time.now.strftime("%Y/%m/%d %T %Z")
=> "2011/12/11 20:56:29 MMT"
irb(main):002:0> Time.now.strftime("%Y/%m/%d %T %z")
=> "2011/12/11 20:56:31 +0630"
irb(main):003:0>
julien@dev:~$ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
julien@dev:~$
```

I tried to parse these in Javascript with `new Date` as the relatizeDate method from `relatize_date.js` do it.

```javascript
>>> new Date("2011/12/11 20:56:29 MMT") // ruby: Time.now.strftime("%Y/%m/%d %T %Z")
Date {Invalid Date}
>>> new Date("2011-12-11 13:55:37 +0630") // ruby: Time.now.strftime("%Y-%m-%d %T %z")
Date {Invalid Date}
>>> new Date("2011/12/11 13:55:37 +0630") // ruby: Time.now.strftime("%Y/%m/%d %T %z") proposed in #297
Date {Sun Dec 11 2011 13:55:37 GMT+0630 (Myanmar Standard Time)}
>>> new Date("Sun, 11 Dec 2011 21:03:13 +0630") // ruby: Time.now.rfc822
Date {Sun Dec 11 2011 21:03:13 GMT+0630 (Myanmar Standard Time)}
```

I will submit a pull request asap to fix the format of the time attributes i have found in the "worker" object.