Made a timestamp to ISO date (#66)

This commit is contained in:
Lu 2023-01-18 22:41:09 +03:00 committed by GitHub
parent 530239245c
commit a5f5208a89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 6 deletions

View File

@ -93,6 +93,7 @@ import { ImportSheet } from './shared/import-sheet/import-sheet';
import { EventButtonsComponent } from './shared/event-buttons/event-buttons';
import { ContentMusicComponent } from './shared/content-music/content-music';
import { MediaPlayerComponent } from './shared/media-player/media-player';
import { DateComponent } from './shared/date/date';
@NgModule({
declarations: [
@ -143,6 +144,7 @@ import { MediaPlayerComponent } from './shared/media-player/media-player';
EventButtonsComponent,
ContentMusicComponent,
MediaPlayerComponent,
DateComponent
],
imports: [
HttpClientModule,

View File

@ -42,7 +42,7 @@
<div class="events above-event clickable" (click)="navigation.openEvent($event, event)" *ngIf="thread.above$ | async as event">
<div class="events-header">
<app-event-header [pubkey]="event.pubkey"><span class="event-date" [matTooltip]="event.created_at.toString()">{{ event.created_at | ago }}</span> <app-directory-icon [pubkey]="event.pubkey"></app-directory-icon></app-event-header>
<app-event-header [pubkey]="event.pubkey"> <app-date [date]="event.created_at"> </app-date> <app-directory-icon [pubkey]="event.pubkey"></app-directory-icon></app-event-header>
<app-event-actions [event]="event" [pubkey]="event.pubkey"></app-event-actions>
</div>
<app-content class="thread-content" [ngClass]="{ 'no-lines': !optionsService.options.showLines, 'lines': optionsService.options.showLines }" [event]="event"></app-content>
@ -52,7 +52,7 @@
<div class="current-event events noclick" *ngIf="thread.event$ | async as event">
<div class="events-header">
<app-event-header [pubkey]="event.pubkey"><span class="event-date" [matTooltip]="event.created_at.toString()">{{ event.created_at | ago }}</span> <app-directory-icon [pubkey]="event.pubkey"></app-directory-icon></app-event-header>
<app-event-header [pubkey]="event.pubkey"><app-date [date]="event.created_at"> </app-date> <app-directory-icon [pubkey]="event.pubkey"></app-directory-icon></app-event-header>
<app-event-actions [event]="event" [pubkey]="event.pubkey"></app-event-actions>
</div>
<app-content class="thread-content" [ngClass]="{ 'no-lines': !optionsService.options.showLines, 'lines': optionsService.options.showLines }" [event]="event"></app-content>

View File

@ -0,0 +1,3 @@
.event-date {
margin-right: 0.1em;
}

View File

@ -0,0 +1 @@
<span class="event-date" (click)="toggle()" *ngIf="!isoDate">{{ date | ago }}</span> <span class="event-date" (click)="toggle()" *ngIf="isoDate">{{ date*1000 | date: 'yyyy-MM-dd HH:mm:ss' }}</span>

View File

@ -0,0 +1,14 @@
import { Component, Input } from '@angular/core';
@Component({
selector: 'app-date',
templateUrl: 'date.html',
styleUrls: ['date.css'],
})
export class DateComponent {
@Input() date!: number;
isoDate?: boolean;
toggle() {
this.isoDate = !this.isoDate;
}
}

View File

@ -623,10 +623,6 @@ mat-sidenav-content mat-toolbar {
text-align: center;
}
.event-date {
margin-right: 0.1em;
}
.options-slider {
margin-right: 1em;
}