date display logic to use moment.js.

pull/477/head
William Kim 11 years ago
parent ba7e791985
commit d67a492b6c

@ -118,9 +118,24 @@ var ApprovedSiteView = Backbone.View.extend({
render: function() { render: function() {
var formattedDate = {creationDate: moment(this.model.creationDate).format("ddd, hA"), var creationDate = moment(this.model.get("creationDate"));
accessDate: moment(this.model.accessDate), var accessDate = moment(this.model.get("accessDate"));
timeoutDate: moment(this.model.timeoutDate)};
var timeoutDate = moment(this.model.get("timeoutDate")).calendar();
if (moment().diff(creationDate, 'months') < 6) {
creationDate = creationDate.fromNow();
} else {
creationDate = creationDate.format("MMMM Do, YYYY");
}
if (moment().diff(accessDate, 'months') < 6) {
accessDate = accessDate.fromNow();
} else {
accessDate = accessDate.format("MMMM Do, YYYY");
}
var formattedDate = {creationDate: creationDate, accessDate: accessDate, timeoutDate: timeoutDate};
var json = {grant: this.model.toJSON(), client: this.options.client.toJSON(), formattedDate: formattedDate}; var json = {grant: this.model.toJSON(), client: this.options.client.toJSON(), formattedDate: formattedDate};

Loading…
Cancel
Save