mirror of
https://github.com/moparisthebest/mailcatcher
synced 2024-08-13 17:03:45 -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
|
new Date match[1], match[2] - 1, match[3], match[4], match[5], match[6], 0
|
||||||
|
|
||||||
offsetTimeZone: (date) ->
|
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.setTime(date.getTime() - offset)
|
||||||
date
|
date
|
||||||
|
|
||||||
formatDate: (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")
|
date &&= date.toString("dddd, d MMM yyyy h:mm:ss tt")
|
||||||
|
|
||||||
haveMessage: (message) ->
|
haveMessage: (message) ->
|
||||||
|
@ -87,9 +87,8 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
MailCatcher.prototype.formatDate = function(date) {
|
MailCatcher.prototype.formatDate = function(date) {
|
||||||
if (typeof date === "string") {
|
if (typeof date === "string") date && (date = this.parseDate(date));
|
||||||
date && (date = this.offsetTimeZone(this.parseDate(date)));
|
date && (date = this.offsetTimeZone(date));
|
||||||
}
|
|
||||||
return date && (date = date.toString("dddd, d MMM yyyy h:mm:ss tt"));
|
return date && (date = date.toString("dddd, d MMM yyyy h:mm:ss tt"));
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -197,8 +196,8 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
MailCatcher.prototype.subscribeWebSocket = function() {
|
MailCatcher.prototype.subscribeWebSocket = function() {
|
||||||
var secure,
|
var secure;
|
||||||
_this = this;
|
var _this = this;
|
||||||
secure = window.location.scheme === 'https';
|
secure = window.location.scheme === 'https';
|
||||||
this.websocket = new WebSocket("" + (secure ? 'wss' : 'ws') + "://" + window.location.host + "/messages");
|
this.websocket = new WebSocket("" + (secure ? 'wss' : 'ws') + "://" + window.location.host + "/messages");
|
||||||
return this.websocket.onmessage = function(event) {
|
return this.websocket.onmessage = function(event) {
|
||||||
|
Loading…
Reference in New Issue
Block a user