fix: use localized date and time

This commit is contained in:
Michel Jonathan Schmitz
2021-02-09 16:59:50 +00:00
committed by Wieland Schöbl
parent 8280917312
commit 6ca0b97637
12 changed files with 17 additions and 47 deletions

View File

@@ -6,7 +6,7 @@
<ion-icon name="pin"></ion-icon>
<a [routerLink]="['/data-detail', offer.inPlace.uid]">{{offer.inPlace.name}}</a>,&nbsp;
<span *ngIf="offer.availabilityStarts">
<ion-icon name="calendar"></ion-icon> {{offer.availabilityStarts | date}}
<ion-icon name="calendar"></ion-icon> {{offer.availabilityStarts | amDateFormat:'ll'}}
</span>
</p>
<ion-grid *ngFor="let group of objectKeys(offer.prices)">

View File

@@ -1,9 +1,9 @@
<ion-card *ngIf="origin.type === 'user'">
<ion-card-header>Origin(user)</ion-card-header>
<ion-card-content>
<p>Created: {{origin.created | amDateFormat:'DD. MMM YYYY'}}</p>
<p *ngIf="origin.updated">Updated: {{origin.updated | amDateFormat:'DD. MMM YYYY'}}</p>
<p *ngIf="origin.modified">Modified: {{origin.modified | amDateFormat:'DD. MMM YYYY'}}</p>
<p>Created: {{origin.created | amDateFormat:'ll'}}</p>
<p *ngIf="origin.updated">Updated: {{origin.updated | amDateFormat:'ll'}}</p>
<p *ngIf="origin.modified">Modified: {{origin.modified | amDateFormat:'ll'}}</p>
<p *ngIf="origin.maintainer">
Maintainer: <a [routerLink]="['/data-detail', origin.maintainer.uid]">{{origin.maintainer.name}}</a>
</p>
@@ -13,8 +13,8 @@
<ion-card *ngIf="origin.type === 'remote'">
<ion-card-header>Origin(remote)</ion-card-header>
<ion-card-content>
<p>Indexed: {{origin.indexed | amDateFormat:'DD. MMM YYYY'}}</p>
<p *ngIf="origin.modified">Modified: {{origin.modified | amDateFormat:'DD. MMM YYYY'}}</p>
<p>Indexed: {{origin.indexed | amDateFormat:'ll'}}</p>
<p *ngIf="origin.modified">Modified: {{origin.modified | amDateFormat:'ll'}}</p>
<p *ngIf="origin.maintainer">
Maintainer: <a [routerLink]="['/data-detail', origin.maintainer.uid]">{{origin.maintainer.name}}</a>
</p>

View File

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

View File

@@ -1,6 +1,6 @@
<stapps-simple-card [title]="'Categories'" [content]="translator.translate(item).categories()">
</stapps-simple-card>
<stapps-simple-card *ngIf="item.datePublished" [title]="'Published'"
[content]="item.datePublished | amDateFormat:'DD. MMM YYYY'"></stapps-simple-card>
[content]="item.datePublished | amDateFormat:'ll'"></stapps-simple-card>
<stapps-simple-card [title]="'Content'" [content]="translator.translate(item).articleBody()" [isMarkdown]="true">
</stapps-simple-card>

View File

@@ -6,7 +6,7 @@
<ion-icon name="calendar"></ion-icon>
<span>
{{item.frequency}}, {{item.dates[0] | amDateFormat:'dddd'}}
<span>({{item.dates[0] | amDateFormat:'DD. MMM YYYY'}} - {{item.dates[item.dates.length - 1] | amDateFormat:'DD. MMM YYYY'}})</span>
<span>({{item.dates[0] | amDateFormat:'ll'}} - {{item.dates[item.dates.length - 1] | amDateFormat:'ll'}})</span>
</span>
</p>
<ion-note *ngIf="item.event.type === 'academic event'">{{item.event.categories.join(', ')}}</ion-note>

View File

@@ -1,5 +1,5 @@
<stapps-simple-card [title]="'Content'" [content]="item.messageBody"></stapps-simple-card>
<stapps-simple-card [title]="'Audiences'" [content]="item.audiences"></stapps-simple-card>
<stapps-simple-card *ngIf="item.datePublished" [title]="'Published'" [content]="item.datePublished | amDateFormat:'DD. MMM YYYY'"></stapps-simple-card>
<stapps-simple-card *ngIf="item.datePublished" [title]="'Published'" [content]="item.datePublished | amDateFormat:'ll'"></stapps-simple-card>
<stapps-simple-card *ngIf="item.authors" [title]="'Author(s)'" [content]="item.authors"></stapps-simple-card>
<stapps-simple-card *ngIf="item.publishers" [title]="'Publisher(s)'" [content]="item.publishers"></stapps-simple-card>

View File

@@ -121,7 +121,7 @@ export class PlaceMensaDetailComponent implements AfterViewInit {
}
}
if (selectedDishes.length) {
out[startingDay.format('YYYY-MM-DD')] = selectedDishes;
out[startingDay.format('L')] = selectedDishes;
}
// tslint:disable-next-line:no-parameter-reassignment
startingDay = nextDay;

View File

@@ -1,2 +1,2 @@
<ion-card *ngIf="item.eventsStartDate && item.eventsEndDate">
<stapps-simple-card [title]="'Events'" [content]="(item.eventsStartDate | amDateFormat: 'DD. MMM YYYY') + ' - ' + (item.eventsEndDate | amDateFormat: 'DD. MMM YYYY')"></stapps-simple-card>
<stapps-simple-card [title]="'Events'" [content]="(item.eventsStartDate | amDateFormat: 'll') + ' - ' + (item.eventsEndDate | amDateFormat: 'll')"></stapps-simple-card>

View File

@@ -4,7 +4,7 @@
<h2 class="name">{{item.name}}</h2>
<p>
<ion-icon name="calendar"></ion-icon>
<span>{{item.startDate | amDateFormat: 'DD. MMM YYYY'}} - {{item.endDate | amDateFormat:'DD. MMM YYYY'}}</span>
<span>{{item.startDate | amDateFormat: 'll'}} - {{item.endDate | amDateFormat:'ll'}}</span>
</p>
<ion-note>{{item.type}}</ion-note>
</ion-col>

View File

@@ -2,5 +2,5 @@
<stapps-simple-card *ngIf="item.authors" [title]="'Authors'" [content]="item.authors"></stapps-simple-card>
<stapps-simple-card *ngIf="item.datePublished" [title]="'Authors'" [content]="item.authors"></stapps-simple-card>
<stapps-simple-card *ngIf="item.datePublished" [title]="'Published'"
[content]="item.datePublished | amDateFormat:'DD. MMM YYYY'"></stapps-simple-card>
[content]="item.datePublished | amDateFormat:'ll'"></stapps-simple-card>
<stapps-offers-detail *ngIf="item.offers" [offers]="item.offers"></stapps-offers-detail>

View File

@@ -13,9 +13,7 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Component, Input} from '@angular/core';
import {LangChangeEvent, TranslateService} from '@ngx-translate/core';
import {SCLanguageCode, SCMessage} from '@openstapps/core';
import {Subscription} from 'rxjs';
import {SCMessage} from '@openstapps/core';
/**
* News page component
*/
@@ -29,31 +27,5 @@ export class NewsItemComponent {
* News (message) to show
*/
@Input() item: SCMessage;
/**
* Current language
*/
language: string;
/**
* Current language subscription
*/
languageSubscription: Subscription;
constructor(private translateService: TranslateService) {}
/**
* Remove language subscription on component destruction
*/
ngOnDestroy() {
this.languageSubscription?.unsubscribe();
}
/**
* Initialize the local variables on component initialization
*/
ngOnInit() {
this.language = this.translateService.currentLang as SCLanguageCode;
this.languageSubscription = this.translateService.onLangChange.subscribe((event: LangChangeEvent) => {
this.language = event.lang as SCLanguageCode;
});
}
}

View File

@@ -14,9 +14,7 @@
</ion-thumbnail>
</ng-template>
<ion-card-header>
<ion-card-subtitle *ngIf="item.datePublished">{{item.datePublished | amLocale: language | amDateFormat:'Do MMMM YYYY, HH:mm'}}
<span *ngIf="language === 'de'">Uhr</span>
</ion-card-subtitle>
<ion-card-subtitle *ngIf="item.datePublished">{{item.datePublished | amDateFormat:'LLL'}}</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>