SUPPORT-9533: refactor
This commit is contained in:
parent
8b8be81bf3
commit
dc7448b8bf
1 changed files with 4 additions and 4 deletions
|
|
@ -19,6 +19,7 @@ import {StaticGridColumn} from "../../../generated/ru/micord/ervu/property/grid/
|
|||
import {CustomGridColumnFilterUtils} from "./filter/CustomGridColumnFilterUtils";
|
||||
|
||||
export class StaticColumnInitializer {
|
||||
private static readonly ZONED_DATE_TIME_FORMAT = 'DD.MM.YYYY HH:mm:ss (Z)';
|
||||
|
||||
public static columnToColumnDef(gridRef: any, column: StaticGridColumn) {
|
||||
const columnDef: ColDef = {};
|
||||
|
|
@ -76,7 +77,7 @@ export class StaticColumnInitializer {
|
|||
if (!cellValue) {
|
||||
return -1;
|
||||
}
|
||||
const cellMoment = moment(cellValue, 'DD.MM.YYYY HH:mm:ss (Z)');
|
||||
const cellMoment = moment(cellValue, StaticColumnInitializer.ZONED_DATE_TIME_FORMAT);
|
||||
|
||||
if (!cellMoment.isValid()) {
|
||||
return -1;
|
||||
|
|
@ -126,9 +127,8 @@ export class StaticColumnInitializer {
|
|||
|
||||
private static zonedDateTimeComparator(): (valueA: any, valueB: any) => number {
|
||||
return (valueA: any, valueB: any) => {
|
||||
const format = 'DD.MM.YYYY HH:mm:ss (Z)';
|
||||
const momentA = moment(valueA, format);
|
||||
const momentB = moment(valueB, format);
|
||||
const momentA = moment(valueA, StaticColumnInitializer.ZONED_DATE_TIME_FORMAT);
|
||||
const momentB = moment(valueB, StaticColumnInitializer.ZONED_DATE_TIME_FORMAT);
|
||||
return ComparisonUtils.momentCompare(momentA, momentB);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue