mirror of
https://github.com/moparisthebest/mailcatcher
synced 2024-11-10 11:15:04 -05:00
Who knew JavaScript thinks months are 0-offset? Fixes #14
This commit is contained in:
parent
d2bb7e8c66
commit
51e74fdac2
@ -47,7 +47,7 @@ class MailCatcher
|
|||||||
parseDateRegexp: /^(\d{4})[-\/\\](\d{2})[-\/\\](\d{2})(?:\s+|T)(\d{2})[:-](\d{2})[:-](\d{2})(?:([ +-]\d{2}:\d{2}|\s*\S+|Z?))?$/
|
parseDateRegexp: /^(\d{4})[-\/\\](\d{2})[-\/\\](\d{2})(?:\s+|T)(\d{2})[:-](\d{2})[:-](\d{2})(?:([ +-]\d{2}:\d{2}|\s*\S+|Z?))?$/
|
||||||
parseDate: (date) ->
|
parseDate: (date) ->
|
||||||
if match = @parseDateRegexp.exec(date)
|
if match = @parseDateRegexp.exec(date)
|
||||||
new Date match[1], match[2], match[3], match[4], match[5], match[6], 0
|
new Date match[1], match[2] - 1, match[3], match[4], match[5], match[6], 0
|
||||||
|
|
||||||
formatDate: (date) ->
|
formatDate: (date) ->
|
||||||
date &&= @parseDate(date) if typeof(date) == "string"
|
date &&= @parseDate(date) if typeof(date) == "string"
|
||||||
|
@ -63,7 +63,7 @@
|
|||||||
MailCatcher.prototype.parseDate = function(date) {
|
MailCatcher.prototype.parseDate = function(date) {
|
||||||
var match;
|
var match;
|
||||||
if (match = this.parseDateRegexp.exec(date)) {
|
if (match = this.parseDateRegexp.exec(date)) {
|
||||||
return new Date(match[1], match[2], match[3], match[4], match[5], match[6], 0);
|
return new Date(match[1], match[2] - 1, match[3], match[4], match[5], match[6], 0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
MailCatcher.prototype.formatDate = function(date) {
|
MailCatcher.prototype.formatDate = function(date) {
|
||||||
|
Loading…
Reference in New Issue
Block a user