diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/timeseries-table-widget-settings.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/timeseries-table-widget-settings.component.html index d70ae9964b..51faa02c66 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/timeseries-table-widget-settings.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/timeseries-table-widget-settings.component.html @@ -36,6 +36,19 @@ {{ 'widgets.table.display-milliseconds' | translate }} +
+
widgets.table.time-format
+ + + + {{ 'widgets.table.time-format-12h' | translate }} + + + {{ 'widgets.table.time-format-24h' | translate }} + + + +
{{ 'widgets.table.enable-sticky-action' | translate }} diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/timeseries-table-widget-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/timeseries-table-widget-settings.component.ts index eaa86f6503..ea3f8e4f1a 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/timeseries-table-widget-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/timeseries-table-widget-settings.component.ts @@ -48,6 +48,7 @@ export class TimeseriesTableWidgetSettingsComponent extends WidgetSettingsCompon reserveSpaceForHiddenAction: 'true', showTimestamp: true, showMilliseconds: false, + timeFormat: '24h', displayPagination: true, useEntityLabel: false, defaultPageSize: 10, @@ -68,6 +69,7 @@ export class TimeseriesTableWidgetSettingsComponent extends WidgetSettingsCompon reserveSpaceForHiddenAction: [settings.reserveSpaceForHiddenAction, []], showTimestamp: [settings.showTimestamp, []], showMilliseconds: [settings.showMilliseconds, []], + timeFormat: [settings.timeFormat, []], displayPagination: [settings.displayPagination, []], useEntityLabel: [settings.useEntityLabel, []], defaultPageSize: [settings.defaultPageSize, [Validators.min(1)]], diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts index 2b7d538a4d..5a424537e9 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts @@ -99,6 +99,7 @@ export interface TimeseriesTableWidgetSettings extends TableWidgetSettings { showTimestamp: boolean; showMilliseconds: boolean; hideEmptyLines: boolean; + timeFormat: '12h' | '24h'; } interface TimeseriesWidgetLatestDataKeySettings extends TableWidgetDataKeySettings { @@ -320,7 +321,8 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI this.hideEmptyLines = isDefined(this.settings.hideEmptyLines) ? this.settings.hideEmptyLines : false; this.useEntityLabel = isDefined(this.widgetConfig.settings.useEntityLabel) ? this.widgetConfig.settings.useEntityLabel : false; this.showTimestamp = this.settings.showTimestamp !== false; - this.dateFormatFilter = (this.settings.showMilliseconds !== true) ? 'yyyy-MM-dd HH:mm:ss' : 'yyyy-MM-dd HH:mm:ss.SSS'; + const timeFormat: '12h' | '24h' = isDefined(this.settings.timeFormat) ? this.settings.timeFormat : '24h'; + this.dateFormatFilter = `yyyy-MM-dd ${timeFormat === '24h' ? 'HH' : 'hh'}:mm:ss${this.settings.showMilliseconds ? '.SSS' : ''}`; this.rowStylesInfo = getRowStyleInfo(this.settings, 'rowData, ctx'); diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index ef660731bf..bc5487d1db 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -6318,7 +6318,10 @@ "timeseries-column-error": "At least one timeseries column should be specified", "alarm-column-error": "At least one alarm column should be specified", "table-tabs": "Table tabs", - "show-cell-actions-menu-mobile": "Show cell actions dropdown menu in mobile mode" + "show-cell-actions-menu-mobile": "Show cell actions dropdown menu in mobile mode", + "time-format": "Time format", + "time-format-12h": "12H", + "time-format-24h": "24H" }, "wind-speed-direction": { "layout": "Layout",