fix(console): Timestamp to date Pipe type coercion (#10588)

# Which Problems Are Solved
Correctly display timestamps even if the seconds or nanos property is 0.

# How the Problems Are Solved
Instead of relying on javascript type coercion correctly check explictly
for undefined.

# Additional Changes

Use TypeSafeCellDefModule in personal-access-tokens component.

# Additional Context

- Closes #10032

Co-authored-by: Max Peintner <[email protected]>
Co-authored-by: Livio Spring <[email protected]>
This commit is contained in:
Ramon
2025-09-01 06:02:35 +00:00
committed by GitHub
co-authored by Max Peintner Livio Spring
parent a9ebc06c77
commit 93fd27aebe
4 changed files with 11 additions and 10 deletions
@@ -7,7 +7,7 @@ import { Timestamp } from 'src/app/proto/generated/google/protobuf/timestamp_pb'
})
export class TimestampToDatePipe implements PipeTransform {
transform(date: BufTimestamp | Timestamp.AsObject | undefined): Date | undefined {
if (date?.seconds && date.nanos) {
if (date?.seconds !== undefined && date.nanos !== undefined) {
return new Date(Number(date.seconds) * 1000 + date.nanos / 1000 / 1000);
}
return undefined;