fknop / angular-pipes

Useful pipes for Angular
https://fknop.gitbook.io/angular-pipes/
MIT License
732 stars 157 forks source link

Feature Request: duration pipes #73

Open antidote2 opened 6 years ago

antidote2 commented 6 years ago

Thank you! I like this library! Did I miss something or why duration pipes are not included. I would like to be able to convert for example milliseconds to minutes. value_in_ms = 60000; {{value_in_ms | duration: ms: min}} would print "1 min"

fknop commented 6 years ago

Hello, you can check out https://github.com/urish/ngx-moment for all pipes related to time and durations.

antidote2 commented 6 years ago

I already checked and it actually fits special cases. Don't like their humanize method. I want to be able to cast exactly the output that I need. Simple configurable pipes would do that. No need for humanize magic. https://github.com/urish/ngx-moment/blob/master/src/duration.pipe.ts

thelebdev commented 5 years ago

What exactly is your request? (e.g. use case, since milliseconds is not something most people would use)

antidote2 commented 5 years ago

I want to provide a duration value together with units: like 60000 + ms or 15.43 + min. As output I would expect a similar simple conversion like is done for bytes/KB/MB/GB... As human you don't want to see 60000 ms - you want to see 1 min. moment.js produces for 1-2 seconds "a few seconds". You cannot use this for a datatable.