mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-30 13:32:46 +00:00
fix: use localized date and time
This commit is contained in:
committed by
Wieland Schöbl
parent
8280917312
commit
6ca0b97637
@@ -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;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user