Add Angular filter for padding a number
This is needed because of the way Frames are stored on the filesystem, such as 00051-capture.jpg, vs. how they're stored in the database, such as 51
This commit is contained in:
parent
8311951c86
commit
786009407c
|
@ -187,3 +187,14 @@ ZoneMinder.filter('DateDiff', function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ZoneMinder.filter('zpad', function() {
|
||||||
|
return function(input, n) {
|
||||||
|
if(input === undefined)
|
||||||
|
input = ""
|
||||||
|
if(input.length >= n)
|
||||||
|
return input
|
||||||
|
var zeros = "0".repeat(n);
|
||||||
|
return (zeros + input).slice(-1 * n)
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in New Issue