mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-06-23 15:30:34 -04:00
21 lines
605 B
TypeScript
21 lines
605 B
TypeScript
import { Pipe, PipeTransform } from '@angular/core';
|
|
import {TranslocoService} from "@jsverse/transloco";
|
|
|
|
@Pipe({
|
|
name: 'defaultDate',
|
|
pure: true,
|
|
standalone: true
|
|
})
|
|
export class DefaultDatePipe implements PipeTransform {
|
|
|
|
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;
|
|
}
|
|
|
|
}
|