import { DatePipe } from '@angular/common/src/pipes/date_pipe';
|
import { Types } from './../enum/types.enum';
|
|
import { Pipe, PipeTransform } from '@angular/core';
|
import { TranslateService } from '@ngx-translate/core';
|
import { NzDatePipe } from 'ng-zorro-antd/src/util/nz-date.pipe';
|
import { DateService } from '@core/services/date.service';
|
import { Column } from '@core/entity/grid';
|
|
|
|
@Pipe({
|
name: 'tyepHandle'
|
})
|
export class TyepHandlePipe implements PipeTransform {
|
constructor(private dateService: DateService) {
|
}
|
|
transform(value: any, col?: Column): any {
|
const t = Types.Date;
|
const type = col.type;
|
if(type!=null&&type.name!=null){
|
value = this.transformHandle(value,type.name,type.format);
|
}
|
return value;
|
}
|
private transformHandle(value:any,type: Types,format:any):any{
|
switch(type){
|
case Types.Date:
|
return this.dateService.date_format(value,format);
|
}
|
}
|
}
|