Commit 3f23934d authored by Sean Hammond's avatar Sean Hammond

Simplify some code

parent f32769d5
...@@ -121,15 +121,12 @@ var BREAKPOINTS = [ ...@@ -121,15 +121,12 @@ var BREAKPOINTS = [
function getBreakpoint(date, now) { function getBreakpoint(date, now) {
var breakpoint; var breakpoint;
for (var i = 0; i < BREAKPOINTS.length; i++) { for (var i = 0; i < BREAKPOINTS.length; i++) {
if (BREAKPOINTS[i].test(date, now)) {
breakpoint = BREAKPOINTS[i]; breakpoint = BREAKPOINTS[i];
break; if (breakpoint.test(date, now)) {
return breakpoint;
} }
} }
return breakpoint;
} }
function nextFuzzyUpdate(date) { function nextFuzzyUpdate(date) {
...@@ -195,11 +192,7 @@ function toFuzzyString(date) { ...@@ -195,11 +192,7 @@ function toFuzzyString(date) {
} }
var now = new Date(); var now = new Date();
var breakpoint = getBreakpoint(date, now); return getBreakpoint(date, now).format(new Date(date), now);
if (!breakpoint) {
return '';
}
return breakpoint.format(new Date(date), now);
} }
module.exports = { module.exports = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment