DatePipe Error only on Safari

My suggestion would be "don’t use the DatePipe". It’s trivial to roll your own that is not dependent on browser support:

declare function require(name:string): any;
let format = require('date-fns/format');
@Pipe({
  name: 'dateformat'
})
@Injectable()
export class DateFormatPipe implements PipeTransform {
  transform(d: Date | string, fmt: string): string {
    let rv = format(d, fmt);
    return rv;
  }
}
1 Like