Skip to content

Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.

649 B
Raw Blame
import { Pipe, PipeTransform } from '@angular/core';
import {TranslocoService} from "@ngneat/transloco";

@Pipe({
  name: 'defaultDate',
  pure: true,
  standalone: true
})
export class DefaultDatePipe implements PipeTransform {

  // TODO: Figure out how to translate Never
  constructor(private translocoService: TranslocoService) {
  }
  transform(value: any, replacementString = 'default-date-pipe.never'): string {
    if (value === null || value === undefined || value === '' || value === Infinity || Number.isNaN(value) || value === '1/1/01') {
      return this.translocoService.translate(replacementString);
    };
    return value;
  }

}