mmiklavc commented on a change in pull request #1495: METRON-2211: [UI] Alerts 
UI should optionally render timestamp in local time
URL: https://github.com/apache/metron/pull/1495#discussion_r321465753
 
 

 ##########
 File path: 
metron-interface/metron-alerts/src/app/alerts/alerts-list/table-view/table-view.component.ts
 ##########
 @@ -187,9 +191,12 @@ export class TableViewComponent implements OnInit, 
OnChanges, OnDestroy {
   }
 
   formatValue(column: ColumnMetadata, returnValue: string) {
+    this.localTime = this.timezoneConfigService.getTimezoneConfig();
     try {
-      if (column.name.endsWith(':ts') || column.name.endsWith('timestamp')) {
-        returnValue = new Date(parseInt(returnValue, 
10)).toISOString().replace('T', ' ').slice(0, 19);
+      if ((column.name.endsWith(':ts') || column.name.endsWith('timestamp')) 
&& this.localTime === true) {
+        returnValue = moment.utc(returnValue).local().format('YYYY-MM-DD 
H:mm:ss');
 
 Review comment:
   One small Q here - can you confirm how this will work when the user's 
browser and the host server are in 2 different time zones? I'm assuming that 
since this is Angular client-side code it will the user's location, not the 
location of the Metron installation.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to