Advertisement
bebo231312312321

Untitled

Mar 22nd, 2024
750
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { Pipe, PipeTransform } from '@angular/core';
  2.  
  3. @Pipe({
  4.   name: 'dataRange',
  5.   standalone: true
  6. })
  7. export class DataRangePipe implements PipeTransform {
  8.   transform(value: { start: string; end: string; } | null | undefined): string {
  9.     if (!value || !value.start || !value.end) {
  10.       return 'Неопределен период';
  11.     }
  12.     const startDate = new Date(value.start).toLocaleDateString();
  13.     const endDate = new Date(value.end).toLocaleDateString();
  14.  
  15.     return `${startDate} - ${endDate}`;
  16.   }
  17.  
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement