import { Pipe, PipeTransform } from '@angular/core';
import {AppService} from "../app.service";

@Pipe({
  name: 'eventDate'
})
export class EventDatePipe implements PipeTransform {

  constructor(private appService: AppService) {

  }

  transform(unixtime: number, format: 'date' | 'time' | 'datetime' ): unknown {
    const date = format == 'date' || format == 'datetime';
    const time = format == 'time' || format == 'datetime';
    return this.appService.formatDateTime(unixtime,date,time);
  }

}
