mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-2699] added localisation for time ago pipe (#3298)
* [ADF-2699] added localisation to the time-ago pipe * [ADF-2699] added lang to time ago pipe * [ADF-2699] added localisation for time ago pipe * [ADF-2699] removed fdescribe * [ADF-2699] removed comments * [ADF-2699] removed useless default values
This commit is contained in:
@@ -15,9 +15,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { DatePipe } from '@angular/common';
|
||||
|
||||
import { TimeAgoPipe } from '../../pipes';
|
||||
import { DataColumn } from './data-column.model';
|
||||
import { DataRow } from './data-row.model';
|
||||
import { ObjectDataRow } from './object-datarow.model';
|
||||
@@ -107,14 +104,6 @@ export class ObjectDataTableAdapter implements DataTableAdapter {
|
||||
|
||||
let value = row.getValue(col.key);
|
||||
|
||||
if (col.type === 'date') {
|
||||
try {
|
||||
return this.formatDate(col, value);
|
||||
} catch (err) {
|
||||
console.error(`Error parsing date ${value} to format ${col.format}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (col.type === 'icon') {
|
||||
const icon = row.getValue(col.key);
|
||||
return icon;
|
||||
@@ -123,21 +112,6 @@ export class ObjectDataTableAdapter implements DataTableAdapter {
|
||||
return value;
|
||||
}
|
||||
|
||||
formatDate(col: DataColumn, value: any): string {
|
||||
if (col.type === 'date') {
|
||||
const format = col.format || 'medium';
|
||||
if (format === 'timeAgo') {
|
||||
const timeAgoPipe = new TimeAgoPipe();
|
||||
return timeAgoPipe.transform(value);
|
||||
} else {
|
||||
const datePipe = new DatePipe('en-US');
|
||||
return datePipe.transform(value, format);
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
getSorting(): DataSorting {
|
||||
return this._sorting;
|
||||
}
|
||||
|
Reference in New Issue
Block a user