MOBILE-2795 date: Stop using CoreToLocaleString pipe

main
Pau Ferrer Ocaña 2019-01-11 09:41:14 +01:00
parent 65d048c494
commit b23eef0a53
7 changed files with 9 additions and 9 deletions

View File

@ -18,7 +18,7 @@
<img [src]="badge.badgeurl" [alt]="badge.name" item-start core-external-content>
</ion-avatar>
<h2><core-format-text [text]="badge.name"></core-format-text></h2>
<p>{{ badge.dateissued | coreToLocaleString }}</p>
<p>{{ badge.dateissued * 1000 | coreFormatDate :'strftimedatetimeshort' }}</p>
<ion-badge item-end color="danger" *ngIf="badge.dateexpire && currentTime >= badge.dateexpire">
{{ 'addon.badges.expired' | translate }}
</ion-badge>

View File

@ -527,11 +527,10 @@ export class AddonCalendarProvider {
}
const dateTriggered = new Date((event.timestart - (time * 60)) * 1000),
startDate = new Date(event.timestart * 1000),
notification = {
id: event.id,
title: event.name,
text: startDate.toLocaleString(),
text: this.timeUtils.userDate(event.timestart * 1000, 'core.strftimedaydatetime', true),
at: dateTriggered,
channelParams: {
channelID: 'notifications',

View File

@ -75,7 +75,7 @@
<a ion-item text-wrap *ngIf="evidence.actionuser" (click)="openUserProfile(evidence.actionuser.id)">
<ion-avatar core-user-avatar [user]="evidence.actionuser" item-start></ion-avatar>
<h2>{{ evidence.actionuser.fullname }}</h2>
<p>{{ evidence.timemodified | coreToLocaleString }}</p>
<p>{{ evidence.timemodified * 1000 | coreFormatDate }}</p>
</a>
<ion-item text-wrap>
<p><ion-badge color="dark">{{ evidence.gradename }}</ion-badge></p>

View File

@ -22,7 +22,7 @@
</ion-item>
<ion-item text-wrap *ngIf="plan.plan.duedate > 0">
<strong>{{ 'addon.competency.duedate' | translate }}</strong>:
{{ plan.plan.duedate | coreToLocaleString }}
{{ plan.plan.duedate * 1000 | coreFormatDate }}
</ion-item>
<ion-item text-wrap *ngIf="plan.plan.template">
<strong>{{ 'addon.competency.template' | translate }}</strong>:

View File

@ -14,7 +14,7 @@
<ion-list *ngIf="plans.length > 0" no-margin>
<a ion-item text-wrap *ngFor="let plan of plans" [title]="plan.name" (click)="openPlan(plan.id)" [class.core-split-item-selected]="plan.id == planId">
<h2>{{ plan.name }}</h2>
<p *ngIf="plan.duedate > 0">{{ 'addon.competency.duedate' | translate }}: {{ plan.duedate | coreToLocaleString }}</p>
<p *ngIf="plan.duedate > 0">{{ 'addon.competency.duedate' | translate }}: {{ plan.duedate * 1000 | coreFormatDate :'strftimedatetimeshort' }}</p>
<ion-badge text-wrap [color]="plan.statuscolor">{{ plan.statusname }}</ion-badge>
</a>
</ion-list>

View File

@ -36,7 +36,7 @@
<ion-col><core-format-text clean="true" [text]="criteria.details.requirement"></core-format-text></ion-col>
<ion-col><core-format-text [text]="criteria.details.status"></core-format-text></ion-col>
<ion-col>{{ criteria.status }}</ion-col>
<ion-col *ngIf="criteria.timecompleted">{{ criteria.timecompleted | coreToLocaleString }}</ion-col>
<ion-col *ngIf="criteria.timecompleted">{{ criteria.timecompleted * 1000 | coreFormatDate :'strftimedatetimeshort' }}</ion-col>
<ion-col *ngIf="!criteria.timecompleted"></ion-col>
</ion-row>
</ion-item>

View File

@ -14,6 +14,7 @@
import { Pipe, PipeTransform } from '@angular/core';
import { CoreLoggerProvider } from '@providers/logger';
import { CoreTimeUtilsProvider } from '@providers/utils/time';
/**
* Filter to format a timestamp to a locale string. Timestamp can be in seconds or milliseconds.
@ -25,7 +26,7 @@ import { CoreLoggerProvider } from '@providers/logger';
export class CoreToLocaleStringPipe implements PipeTransform {
protected logger;
constructor(logger: CoreLoggerProvider) {
constructor(logger: CoreLoggerProvider, private timeUtils: CoreTimeUtilsProvider) {
this.logger = logger.getInstance('CoreToLocaleStringPipe');
}
@ -56,6 +57,6 @@ export class CoreToLocaleStringPipe implements PipeTransform {
timestamp = timestamp * 1000;
}
return new Date(timestamp).toLocaleString();
return this.timeUtils.userDate(timestamp, 'core.strftimedatetimeshort');
}
}