danrevah / ngx-pipes

⚡️ Useful pipes for Angular with no external dependencies!
https://danrevah.gitbooks.io/angular-pipes
MIT License
1.6k stars 203 forks source link

using TimeAgo pipe for the http response date in string #157

Open WilsonLau0755 opened 5 years ago

WilsonLau0755 commented 5 years ago

I am using ngx-pipes v2.5.6 for my angular8 project.

compare timeAgo pipe and date pipe in angular: When i suscribe the date from server to UI. I pass the date (in Json) to timeAgo pipe, it will output a invalid time. So, i should transform all date in Json to date type first. However, the date pipe in angular , it still works if i pass the date in Json.

So , Is it possible to judge the value type which pass in pipe first? If it is a string and can be tranform into date type by new Date(), transform first and output it. If it is in Date, output it directly.

danrevah commented 5 years ago

Please add a code example