Download CSV: format the dates (#24992)
* export formatted dates * remove if(true) * display processor
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { Vector } from '../types/vector';
|
||||
import { DisplayProcessor } from '../types';
|
||||
import { formattedValueToString } from '../valueFormats';
|
||||
import { vectorToArray } from './vectorToArray';
|
||||
|
||||
export class FormattedVector<T = any> implements Vector<string> {
|
||||
constructor(private source: Vector<T>, private formatter: DisplayProcessor) {}
|
||||
|
||||
get length() {
|
||||
return this.source.length;
|
||||
}
|
||||
|
||||
get(index: number): string {
|
||||
const v = this.source.get(index);
|
||||
return formattedValueToString(this.formatter(v));
|
||||
}
|
||||
|
||||
toArray(): string[] {
|
||||
return vectorToArray(this);
|
||||
}
|
||||
|
||||
toJSON(): string[] {
|
||||
return this.toArray();
|
||||
}
|
||||
}
|
||||
@@ -4,5 +4,6 @@ export * from './CircularVector';
|
||||
export * from './ConstantVector';
|
||||
export * from './BinaryOperationVector';
|
||||
export * from './SortedVector';
|
||||
export * from './FormattedVector';
|
||||
|
||||
export { vectorator } from './FunctionalVector';
|
||||
|
||||
Reference in New Issue
Block a user