You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
834 B
31 lines
834 B
import {ICellRendererAngularComp} from 'ag-grid-angular';
|
|
import {Component} from '@angular/core';
|
|
import {ICellRendererParams} from 'ag-grid-community';
|
|
import * as moment from 'moment';
|
|
|
|
@Component({
|
|
selector: 'editor-datetime-renderer',
|
|
template: `{{ display }}`,
|
|
})
|
|
export class DatetimeRendererComponent implements ICellRendererAngularComp {
|
|
public params: ICellRendererParams;
|
|
public format = 'YYYY-MM-DD h:mm a';
|
|
|
|
agInit(params: ICellRendererParams): void {
|
|
this.params = params;
|
|
// @ts-ignore
|
|
this.format = params.colDef.additionalData.format;
|
|
}
|
|
|
|
public get display() {
|
|
if ( !this.params.value ) {
|
|
return '';
|
|
}
|
|
return moment(this.params.value).format(this.format);
|
|
}
|
|
|
|
refresh(params: any): boolean {
|
|
return false;
|
|
}
|
|
}
|