From 3e93d50d1eaa4601123640046ac01cb9aa20f91e Mon Sep 17 00:00:00 2001 From: Eduard Tihomiorv Date: Mon, 20 Oct 2025 19:20:48 +0300 Subject: [PATCH] SUPPORT-9484: Delete zoneformatter --- .../grid/formatter/ZoneDateTimeFormatter.ts | 38 ------------------- 1 file changed, 38 deletions(-) delete mode 100644 frontend/src/ts/ervu/component/grid/formatter/ZoneDateTimeFormatter.ts diff --git a/frontend/src/ts/ervu/component/grid/formatter/ZoneDateTimeFormatter.ts b/frontend/src/ts/ervu/component/grid/formatter/ZoneDateTimeFormatter.ts deleted file mode 100644 index cae5f315..00000000 --- a/frontend/src/ts/ervu/component/grid/formatter/ZoneDateTimeFormatter.ts +++ /dev/null @@ -1,38 +0,0 @@ -import {DateTimeUtil, DefaultValueFormatter, GridValueFormatter} from "@webbpm/base-package"; -import {ValueFormatterParams} from "ag-grid-community"; - -export class ZoneDateTimeFormatter extends DefaultValueFormatter implements GridValueFormatter { - - public dateFormat: string = ''; - private defaultFormat = 'DD.MM.YYYY HH:mm:ss (Z)'; - - format(params: ValueFormatterParams): string { - if (this.isValueEmpty(params)) { - return super.format(params); - } - - // don't apply formatter to row with aggregation function - if (params.node.isRowPinned()) { - return params.value; - } - - if (!this.dateFormat) { - return ZoneDateTimeFormatter.parseForTimeZoneAndFormat(params.value, this.defaultFormat); - } - - if (!ZoneDateTimeFormatter.isValidFormat(this.dateFormat)) { - throw new Error('Invalid date format = ' + this.dateFormat); - } - - return ZoneDateTimeFormatter.parseForTimeZoneAndFormat(params.value, this.dateFormat); - } - - private static isValidFormat(format: string): boolean { - const validCharsRegex = /^[YyMmDdHhSsTZ.:()\[\] -]*$/; - return format && validCharsRegex.test(format); - } - - private static parseForTimeZoneAndFormat(value: string, dateFormat: string): string { - return DateTimeUtil.parseIsoDateTime(value).local().format(dateFormat); - } -} \ No newline at end of file