diff --git a/resources/static/pages/manage_account.js b/resources/static/pages/manage_account.js index 7509704480aa163e396130553ea976e3f6bc1544..bf53df4284e65171210607f82bd1850a390be455 100644 --- a/resources/static/pages/manage_account.js +++ b/resources/static/pages/manage_account.js @@ -79,12 +79,8 @@ BrowserID.manageAccount = (function() { var template = $("#templateUser").html(); _(emails).each(function(data, e) { - var date = helpers.relativeDate(new Date(data.created)); - var identity = _.template(template, { - email: e, - relative: date.friendly, - created: date.locale + email: e }); var idEl = $(identity).appendTo(list); diff --git a/resources/static/shared/helpers.js b/resources/static/shared/helpers.js index b9a63ca08d6a0b168dad5b8fd8a660cf85aaeeaf..898456d25f3d75aaa90b7151aa11bb95bce1f48f 100644 --- a/resources/static/shared/helpers.js +++ b/resources/static/shared/helpers.js @@ -47,88 +47,6 @@ return url; } - function relativeDate(date) { - var diff = (((new Date()).getTime() - date.getTime()) / 1000), - day_diff = Math.floor(diff / 86400), - dObj = { "friendly" : date.toLocaleDateString(), - "additional" : date.toLocaleTimeString(), - "utc" : date.toUTCString(), - "locale" : date.toLocaleString() }; - - /* some kind of error */ - if (day_diff < 0) { - dObj.friendly = "in the future!?!"; - return dObj; - } else if (isNaN(day_diff)) { - dObj.friendly = dObj.additional = "unknown"; - return dObj; - } - - if (day_diff === 0) { - if (diff < 60) { - dObj.friendly = "just now"; - return dObj; - } - if (diff < 120 + 30) { /* 1 minute plus some fuzz */ - dObj.friendly = "a minute ago"; - return dObj; - } - if (diff < 3600) { - dObj.friendly = Math.floor(diff / 60) + " minutes ago"; - return dObj; - } - if (diff < (60 * 60) * 2) { - dObj.friendly = "1 hour ago"; - return dObj; - } - if (diff < 24 * 60 * 60) { - dObj.friendly = Math.floor(diff / 3600) + " hours ago"; - return dObj; - } - } - if (day_diff === 1) { - dObj.friendly = "yesterday"; - return dObj; - } - if (day_diff < 7) { - dObj.friendly = day_diff + " days ago"; - return dObj; - } - if (day_diff < 8) { - dObj.friendly = "last week"; - return dObj; - } - /* for this scope: we want day of week and the date - plus the month (if different) */ - if (day_diff < 31) { - dObj.friendly = Math.ceil(day_diff / 7) + " weeks ago"; - return dObj; - } - - /* for this scope: we want month + date */ - if (day_diff < 62) { - dObj.friendly = "a month ago"; - return dObj; - } - if (day_diff < 365) { - dObj.friendly = Math.ceil(day_diff / 31) + " months ago"; - return dObj; - } - - /* for this scope: we want month + year */ - if (day_diff >= 365 && day_diff < 730) { - dObj.additional = date.toLocaleDateString(); - dObj.friendly = "a year ago"; - return dObj; - } - if (day_diff >= 365) { - dObj.additional = date.toLocaleDateString(); - dObj.friendly = Math.ceil(day_diff / 365) + " years ago"; - return dObj; - } - return dObj; - } - function cancelEvent(callback) { return function(event) { event && event.preventDefault(); @@ -179,13 +97,6 @@ */ toURL: toURL, - /** - * Get the date relative to now. - * @method relativeDate - * @param {Date} date - * @returns {string} date relative to now. - */ - relativeDate: relativeDate, /** * Return a function that calls preventDefault on the event and then calls * the callback with the arguments. diff --git a/resources/views/index.ejs b/resources/views/index.ejs index be6d42bebfd0145c66c9af4c8fb64153568d6115..f1b6b005de8f96ddb2af3fb8207cce89a23825c2 100644 --- a/resources/views/index.ejs +++ b/resources/views/index.ejs @@ -72,8 +72,6 @@ <div class="email">{{ email }}</div> <div class="activity cf"> <button class="delete">remove</button> - <!-- removed registration info. We want to replace this with Last Used At ... --> - <!-- <abbr title="Registered: {{ created }}" class="status">Registered {{ relative }}.</abbr>--> </div> </li> </script>