
Product
Socket Now Supports pylock.toml Files
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
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 19 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.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.
Research
Security News
Malicious Ruby gems typosquat Fastlane plugins to steal Telegram bot tokens, messages, and files, exploiting demand after Vietnam’s Telegram ban.