fix date, init order
This commit is contained in:
parent
89bdb49662
commit
6158076c44
@ -17,6 +17,7 @@ export class PermissionsComponent implements OnInit {
|
|||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.datetimeformat = this.i18n.get('format.datetime', []);
|
this.datetimeformat = this.i18n.get('format.datetime', []);
|
||||||
|
this.sortData({ "active": "name", "direction": "asc" });
|
||||||
}
|
}
|
||||||
|
|
||||||
sortData(sort: Sort) {
|
sortData(sort: Sort) {
|
||||||
|
@ -16,6 +16,7 @@ export class QuotasComponent implements OnInit {
|
|||||||
constructor(private i18n: I18nService) {}
|
constructor(private i18n: I18nService) {}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
this.sortData({ "active": "name", "direction": "asc" });
|
||||||
}
|
}
|
||||||
|
|
||||||
sortData(sort: Sort) {
|
sortData(sort: Sort) {
|
||||||
|
@ -4,10 +4,14 @@ import * as moment from 'moment';
|
|||||||
@Pipe({ name: 'datef' })
|
@Pipe({ name: 'datef' })
|
||||||
export class MomentPipe implements PipeTransform {
|
export class MomentPipe implements PipeTransform {
|
||||||
transform(value: Date | moment.Moment, dateFormat: string): any {
|
transform(value: Date | moment.Moment, dateFormat: string): any {
|
||||||
|
if (!value) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
if (!dateFormat) {
|
if (!dateFormat) {
|
||||||
return moment(value).fromNow();
|
return moment(value).fromNow();
|
||||||
}
|
}
|
||||||
|
|
||||||
return moment(value).format(dateFormat);
|
return moment(value).format(dateFormat);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user