refactor: replace amDateFormat with new pipes

This commit is contained in:
Rainer Killinger
2021-06-16 16:59:24 +02:00
parent 4b932af1c0
commit 95b183b1bb
7 changed files with 37 additions and 16 deletions

View File

@@ -1,7 +1,7 @@
<div *ngIf="origin.type === 'user'">
<p>{{ origin.created | amDateFormat: 'll' }}</p>
<p>{{origin.created | dateFormat}}</p>
</div>
<div *ngIf="origin.type === 'remote'">
<p>{{ origin.indexed | amDateFormat: 'll' }}</p>
<p>{{origin.indexed | dateFormat}}</p>
</div>

View File

@@ -7,13 +7,11 @@
<ion-icon name="calendar"></ion-icon>
<span>
{{ item.repeatFrequency | amDuration }},
{{ item.dates[0] | amDateFormat: 'dddd' }}
<span
>({{ item.dates[0] | amDateFormat: 'll' }} -
{{
item.dates[item.dates.length - 1] | amDateFormat: 'll'
}})</span
>
{{ item.dates[0] | dateFormat: 'weekday:long' }}
<span>
({{ item.dates[0] | dateFormat }} -
{{ item.dates[item.dates.length - 1] | dateFormat }})
</span>
</span>
</p>
<ion-note *ngIf="item.event.type === 'academic event'">{{

View File

@@ -2,8 +2,8 @@
<div *ngIf="dishes | async as dishes; else loading">
<ion-segment [(ngModel)]="selectedDay" mode="md">
<ion-segment-button *ngFor="let day of dishes | keyvalue" [value]="day.key">
<ion-label class="ion-hide-sm-down">{{day.key | amLocal | amDateFormat:'dddd, l'}}</ion-label>
<ion-label class="ion-hide-sm-up">{{day.key | amLocal | amDateFormat:'dd, l'}}</ion-label>
<ion-label class="ion-hide-sm-down">{{day.key | dateFormat:'weekday:long,month:numeric,day:numeric'}}</ion-label>
<ion-label class="ion-hide-sm-up">{{day.key | dateFormat:'weekday:short,month:numeric,day:numeric' }}</ion-label>
</ion-segment-button>
</ion-segment>
<div [ngSwitch]="selectedDay">

View File

@@ -5,10 +5,7 @@
<h2 class="name">{{ 'name' | thingTranslate: item }}</h2>
<p>
<ion-icon name="calendar"></ion-icon>
<span
>{{ item.startDate | amDateFormat: 'll' }} -
{{ item.endDate | amDateFormat: 'll' }}</span
>
<span>{{item.startDate | dateFormat}} - {{item.endDate | dateFormat}}</span>
</p>
<ion-note>{{ 'type' | thingTranslate: item }}</ion-note>
</div>

View File

@@ -23,7 +23,7 @@
</ng-template>
<ion-card-header>
<ion-card-subtitle *ngIf="item.datePublished">{{
item.datePublished | amDateFormat: 'LLL'
item.datePublished | amCalendar | sentencecase
}}</ion-card-subtitle>
<ion-card-title>
<span *ngIf="item.sameAs; else titleNoUrl"

View File

@@ -43,6 +43,7 @@ const newsRoutes: Routes = [{path: 'news', component: NewsPageComponent}];
],
imports: [
IonicModule.forRoot(),
ThingTranslateModule.forChild(),
TranslateModule.forChild(),
RouterModule.forChild(newsRoutes),
CommonModule,

View File

@@ -0,0 +1,25 @@
<ion-card>
<span *ngIf="item.url; else imageNoUrl">
<a href="{{item.url}}">
<ion-thumbnail><ion-img src="{{item.image}}" (ionError)="$event.target.nextSibling.style.display='block'" alt=""></ion-img>
<ion-icon name="newspaper-outline"></ion-icon>
</ion-thumbnail>
</a>
</span>
<ng-template #imageNoUrl>
<ion-thumbnail>
<ion-img src="{{item.image}}" (ionError)="$event.target.nextSibling.style.display='block'" alt=""></ion-img>
<ion-icon name="newspaper-outline"></ion-icon>
</ion-thumbnail>
</ng-template>
<ion-card-header>
<ion-card-subtitle *ngIf="item.datePublished">{{item.datePublished | amCalendar | sentencecase}}</ion-card-subtitle>
<ion-card-title>
<span *ngIf="item.url; else titleNoUrl"><a href="{{item.url}}"><span class="text">{{item.name}}</span><span class="icon"><ion-icon name="open-outline"></ion-icon></span></a></span>
<ng-template #titleNoUrl>{{item.name}}</ng-template>
</ion-card-title>
</ion-card-header>
<ion-card-content>
{{item.messageBody}}
</ion-card-content>
</ion-card>