Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular datepipe cannot be found

Tags:

angular

I want to use the DatePipe in HTML

{{ timeslot | date }}

but I get the error

error NG8004: No pipe found with name 'date'

My app.module.ts imports the common module

import { CommonModule } from '@angular/common';

@NgModule({
  imports: [
     CommonModule,
  ],
  declarations: [],
}

What I am doing wrong?

like image 741
Jake Avatar asked Mar 25 '26 20:03

Jake


1 Answers

Try to put your component in declarations like:

import { CommonModule } from '@angular/common';

@NgModule({
  imports: [
     CommonModule,
  ],
  declarations: [YourComponent],
}
like image 63
Georges Feungap Avatar answered Mar 27 '26 10:03

Georges Feungap