mirror of
https://github.com/moparisthebest/mailcatcher
synced 2025-03-11 06:50:12 -04:00
Only do timezone offset if we have a date
This commit is contained in:
parent
3d6f2a4b6a
commit
1e717a7d76
@ -58,12 +58,13 @@ class MailCatcher
|
||||
new Date match[1], match[2] - 1, match[3], match[4], match[5], match[6], 0
|
||||
|
||||
offsetTimeZone: (date) ->
|
||||
offset = Date.now().getTimezoneOffset()*60000 #convert timezone difference to milliseconds
|
||||
offset = Date.now().getTimezoneOffset() * 60000 #convert timezone difference to milliseconds
|
||||
date.setTime(date.getTime() - offset)
|
||||
date
|
||||
|
||||
formatDate: (date) ->
|
||||
date &&= @offsetTimeZone(@parseDate(date)) if typeof(date) == "string"
|
||||
date &&= @parseDate(date) if typeof(date) == "string"
|
||||
date &&= @offsetTimeZone(date)
|
||||
date &&= date.toString("dddd, d MMM yyyy h:mm:ss tt")
|
||||
|
||||
haveMessage: (message) ->
|
||||
|
@ -87,9 +87,8 @@
|
||||
};
|
||||
|
||||
MailCatcher.prototype.formatDate = function(date) {
|
||||
if (typeof date === "string") {
|
||||
date && (date = this.offsetTimeZone(this.parseDate(date)));
|
||||
}
|
||||
if (typeof date === "string") date && (date = this.parseDate(date));
|
||||
date && (date = this.offsetTimeZone(date));
|
||||
return date && (date = date.toString("dddd, d MMM yyyy h:mm:ss tt"));
|
||||
};
|
||||
|
||||
@ -197,8 +196,8 @@
|
||||
};
|
||||
|
||||
MailCatcher.prototype.subscribeWebSocket = function() {
|
||||
var secure,
|
||||
_this = this;
|
||||
var secure;
|
||||
var _this = this;
|
||||
secure = window.location.scheme === 'https';
|
||||
this.websocket = new WebSocket("" + (secure ? 'wss' : 'ws') + "://" + window.location.host + "/messages");
|
||||
return this.websocket.onmessage = function(event) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user