time-ago-pipe: doesn't work with angular 9 version
I have an error in console, when try to import TimeAgoPipe and add to module declarations.
So, little “crutch” like that solved my problem
...
import { TimeAgoPipe } from 'time-ago-pipe';
@Pipe({
name: 'timeAgo',
pure: false
})
export class TimeAgoExtendsPipe extends TimeAgoPipe {}
@NgModule({
declarations: [
TimeAgoExtendsPipe,
...
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 40
- Comments: 19
Same problem with Angular 9.
It does work in Angular 9 with one little modification:
Note that you have to implement PipeTransform in order to not get compilation error on
@Pipe
. Not sure why I both have to extend a class which implements an interface AND implement the interface. But this TimeAgo has caused me enough troubles now, so I’m happy enough as long as it is working.I’m getting this with Angular 10 (in Ionic). The fixes above (including @larsnedb’s one ) don’t help me.
Fine until I run a prod build. If I run ionic build --prod I get the error:
EDIT: I ended up switching to ngx-pipes as it has a timeAgo
Hi! the code looks fine, but I still got errors upon compilation 😦
EDIT: I got it just by converting my date to string 😕