Skip to content

Commit

Permalink
Step 1.15: Create calendar filter
Browse files Browse the repository at this point in the history
  • Loading branch information
DAB0mB authored and Dotan Simha committed Nov 23, 2016
1 parent dd1791a commit 46289ec
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions client/scripts/filters/calendar.filter.js
@@ -0,0 +1,17 @@
import Moment from 'moment';
import { Filter } from 'angular-ecmascript/module-helpers';

export default class CalendarFilter extends Filter {
filter(time) {
if (!time) return;

return Moment(time).calendar(null, {
lastDay : '[Yesterday]',
sameDay : 'LT',
lastWeek : 'dddd',
sameElse : 'DD/MM/YY'
});
}
}

CalendarFilter.$name = 'calendar';

0 comments on commit 46289ec

Please sign in to comment.