
Research
/Security News
Contagious Interview Campaign Escalates With 67 Malicious npm Packages and New Malware Loader
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
angular-duration-format
Advanced tools
AngularJS filter for formatting duration.
Add angular-duration-format
as your app dependency.
angular.module('myModule', [
'angular-duration-format'
]);
In templates you can use
<p>
Time passed: {{ passed | duration:'hh:mm:ss:sss' }}<br/>
Preformatted: {{ passedPre }}
</p>
In controllers (or directives, services, anywhere)
angular.module('myModule').controller('exampleCtrl', function($scope, $filter) {
var durationFilter = $filter('duration');
$scope.passed = 123456789;
$scope.passedPre = durationFilter($scope.passed, 'hh:mm:ss:sss');
});
The result should be the same in both cases:
Time passed: 34:17:36:789
Preformatted: 34:17:36:789
Available formatting options:
sss
for millisecondsEach number will be zero-padded to two places if you double letters (ex. hh
, mm
). Milliseconds are exception - they are padded to four places and you have to pass four letters (ssss
).
You can use every separator you want, but be careful. Passing format h hours, m minutes
will produce unexpected results 34 34ours, 17 17inutes
. To avoid that, wrap every separator containing reserved letters in quotaion marks, like that h 'hours', m 'minutes'
. (remember about escaping them in your code!). Now, the result should be nicely formatted 34 hours, 17 minutes
.
Note, that you can ommit some unit "levels", but it can produce weird results. If in example above you change format to hh:ss
, result will be 34:1056
, because 17 minutes and 36 seconds it is 1056 seconds.
FAQs
AngularJS utils for formatting time
The npm package angular-duration-format receives a total of 40 weekly downloads. As such, angular-duration-format popularity was classified as not popular.
We found that angular-duration-format demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.