Download CSV: format the dates (#24992)

* export formatted dates

* remove if(true)

* display processor
This commit is contained in:
Ryan McKinley
2020-05-25 11:12:53 +02:00
committed by GitHub
parent ad870c07cf
commit 81d1f6653f
3 changed files with 57 additions and 0 deletions
@@ -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';