<div class="well">
<div *ngIf="clog">
<p *ngFor="let line of clog">
- <span class="timestamp">{{ line.stamp }}</span>
+ <span class="timestamp">{{ line.stamp | cdDate }}</span>
<span class="priority {{ line.priority | logPriority }}">{{ line.priority }}</span>
<span class="message">{{ line.message }}</span>
</p>
<div class="well">
<div *ngIf="audit_log">
<p *ngFor="let line of audit_log">
- <span class="timestamp">{{ line.stamp }}</span>
+ <span class="timestamp">{{ line.stamp | cdDate }}</span>
<span class="priority {{ line.priority | logPriority }}">{{ line.priority }}</span>
<span class="message">{{ line.message }}</span>
</p>
<select class="form-control"
[(ngModel)]="priority"
(ngModelChange)="filterLogs()">
- <option class="form-control"
+ <option class="form-control"
*ngFor="let prio of prioritys"
[value]="prio.value">{{ prio.name }}</option>
</select>
+import { DatePipe } from '@angular/common';
import { Component, OnDestroy, OnInit } from '@angular/core';
import { LogsService } from '../../../shared/api/logs.service';
selectedDate: Date;
startTime: Date = new Date();
endTime: Date = new Date();
- constructor(private logsService: LogsService) {
+ constructor(private logsService: LogsService, private datePipe: DatePipe) {
this.startTime.setHours(0, 0);
this.endTime.setHours(23, 59);
}
filterExecutor(logs: Array<any>, filters: any): Array<any> {
return logs.filter((line) => {
- const hour = parseInt(line.stamp.slice(11, 13), 10);
- const minutes = parseInt(line.stamp.slice(14, 16), 10);
+ const localDate = this.datePipe.transform(line.stamp, 'mediumTime');
+ const hour = parseInt(localDate.split(':')[0], 10);
+ const minutes = parseInt(localDate.split(':')[1], 10);
let prio: string, y_m_d: string, timeSpan: number;
prio = filters.priority === 'All' ? line.priority : filters.priority;