added date format validity check for moment.js usage.

pull/477/head
William Kim 11 years ago
parent c1607b53e4
commit 025eb05d3a

@ -122,7 +122,7 @@ var ApprovedSiteView = Backbone.View.extend({
var accessDate = this.model.get("accessDate"); var accessDate = this.model.get("accessDate");
var timeoutDate = this.model.get("timeoutDate"); var timeoutDate = this.model.get("timeoutDate");
if (creationDate == null) { if (creationDate == null || !moment(creationDate).isValid()) {
creationDate = "Unknown"; creationDate = "Unknown";
} else { } else {
creationDate = moment(creationDate); creationDate = moment(creationDate);
@ -133,7 +133,7 @@ var ApprovedSiteView = Backbone.View.extend({
} }
} }
if (accessDate == null) { if (accessDate == null || !moment(accessDate).isValid()) {
accessDate = "Unknown"; accessDate = "Unknown";
} else { } else {
accessDate = moment(accessDate); accessDate = moment(accessDate);
@ -144,7 +144,7 @@ var ApprovedSiteView = Backbone.View.extend({
} }
} }
if (timeoutDate == null) { if (timeoutDate == null || !moment(timeoutDate).isValid()) {
timeoutDate = "Never"; timeoutDate = "Never";
} else { } else {
timeoutDate = moment(timeoutDate).calendar(); timeoutDate = moment(timeoutDate).calendar();

Loading…
Cancel
Save