don't try to split empty value
[angular-drzb] / app / js / filters.js
1 'use strict';
2
3 /* Filters */
4
5 angular.module('myApp.filters', []).
6   filter('interpolate', ['version', function(version) {
7     return function(text) {
8       return String(text).replace(/\%VERSION\%/mg, version);
9     }
10   }]).
11   filter('registration_date_time', function() {
12     return function(text) {
13                 if ( ! text ) return '?';
14                 var timestamp = parseInt( text.split(/\./)[1] );
15         var date = new Date(timestamp / 100); // 100000 / 1000
16         return date.toISOString().replace(/T/, ' ').replace(/\.[0-9]{3}Z/, '');
17     }
18   });