captbaritone / captbaritone/datejs

rfc1123 is wrongly formatted by toString

Open
#121 0 comments 0 reactions 0 assignees View on GitHub
auto-migrated Priority-Medium Type-Defect
Dominant language
JavaScript
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

```
What steps will reproduce the problem?
1. Date.parse('Thu Jan 20 19:49:15 +0000 2011').toString('r')

What is the expected output? What do you see instead?

Expected: Wed, 20 Apr 2011 19:49:15 GMT
Obtained: Wed, 20 Apr 2011 19:49:15 G4T

What version of the product are you using? On what operating system?

SVN. Linux + Firefox 4.

Please provide any additional information below.

toString uses a regex to replace placeholders in the given format. rfc1123
format (param 'r' passed to toString) contains a trailing 'GMT', which 'M' is
erroneously matched as month, and replaced by the month number, rendering a
wrong data.

Many solutions can be applied:

- modify the regex to ignore 'GMT'.
- remove 'GMT' from the rfc1123 format string, and prepend it to the resulting
formatted string before returning it.

```

Original issue reported on code.google.com by `aitorc...@gmail.com` on 4 Apr 2011 at 8:27

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.