davidradl commented on code in PR #27552:
URL: https://github.com/apache/flink/pull/27552#discussion_r2792622360


##########
flink-runtime-web/web-dashboard/src/app/components/humanize-watermark.pipe.ts:
##########
@@ -36,16 +37,65 @@ export class HumanizeWatermarkPipe implements PipeTransform 
{
 }
 
 @Pipe({
-  name: 'humanizeWatermarkToDatetime'
+  name: 'humanizeWatermarkToDatetime',
+  standalone: true,
+  pure: false
 })
 export class HumanizeWatermarkToDatetimePipe implements PipeTransform {
   constructor(private readonly configService: ConfigService) {}
 
-  public transform(value: number): number | string {
+  public transform(value: number, timezone: string = 'UTC'): number | string {
     if (value == null || isNaN(value) || value <= 
this.configService.LONG_MIN_VALUE) {
       return 'N/A';
-    } else {
-      return new Date(value).toLocaleString();
+    }
+
+    try {
+      const date = new Date(value);
+
+      // Use Intl.DateTimeFormat for proper timezone handling including DST
+      // This native browser API automatically handles daylight saving time 
transitions
+      const dateFormatter = new Intl.DateTimeFormat('en-US', {
+        timeZone: timezone,
+        year: 'numeric',
+        month: '2-digit',
+        day: '2-digit',
+        hour: '2-digit',
+        hour12: false,
+        minute: '2-digit',
+        second: '2-digit'
+      });
+
+      // Get timezone abbreviation (e.g., PST, PDT, EST, EDT)
+      const timezoneFormatter = new Intl.DateTimeFormat('en-US', {
+        timeZone: timezone,
+        timeZoneName: 'short'
+      });
+
+      // Format the date parts
+      const parts = dateFormatter.formatToParts(date);
+      const year = parts.find(p => p.type === 'year')?.value;
+      const month = parts.find(p => p.type === 'month')?.value;
+      const day = parts.find(p => p.type === 'day')?.value;
+      const hour = parts.find(p => p.type === 'hour')?.value;
+      const minute = parts.find(p => p.type === 'minute')?.value;
+      const second = parts.find(p => p.type === 'second')?.value;
+
+      // Extract timezone abbreviation
+      const timezoneParts = timezoneFormatter.formatToParts(date);
+      const timezoneAbbr = timezoneParts.find(p => p.type === 
'timeZoneName')?.value || timezone;
+
+      return `${year}-${month}-${day} ${hour}:${minute}:${second} 
(${timezoneAbbr})`;

Review Comment:
   can we return whether we are in DST in the format? 



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to