Timestamp component

This commit is contained in:
softsimon committed 2022-07-08 18:55:24 +02:00
1 parent d88e7aea1f
commit 0a15b5d0de
7 files changed
+37 -8

No files matched your search

@@ -0,0 +1,4 @@
‎{{ seconds * 1000 | date:'yyyy-MM-dd HH:mm' }}
<div class="lg-inline">
<i class="symbol">(<app-time-since [time]="seconds" [fastRender]="true"></app-time-since>)</i>
</div>
Whitespace-only changes.
@@ -0,0 +1,25 @@
import { ChangeDetectionStrategy, Component, Input, OnChanges } from '@angular/core';
@Component({
selector: 'app-timestamp',
templateUrl: './timestamp.component.html',
styleUrls: ['./timestamp.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class TimestampComponent implements OnChanges {
@Input() unixTime: number;
@Input() dateString: string;
seconds: number;
constructor() { }
ngOnChanges(): void {
if (this.unixTime) {
this.seconds = this.unixTime;
} else if (this.dateString) {
this.seconds = new Date(this.dateString).getTime() / 1000
}
}
}