mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-22 21:08:47 +00:00
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:
co-authored by
Max Peintner
Livio Spring
parent
a9ebc06c77
commit
93fd27aebe
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user