Fineract backend settings with environment variables
This commit is contained in:
committed by
Arnold Gálovics
parent
1b72136411
commit
14ceb4f3fd
@@ -1,6 +1,7 @@
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
import * as moment from 'moment';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -10,13 +11,20 @@ export class Dates {
|
||||
constructor(private settingsService: SettingsService,
|
||||
private datePipe: DatePipe) {}
|
||||
|
||||
public getDate(timestamp: any) {
|
||||
public getDate(timestamp: any): string {
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
return this.datePipe.transform(timestamp, dateFormat);
|
||||
}
|
||||
|
||||
public formatDate(timestamp: any, dateFormat: string) {
|
||||
public formatDate(timestamp: any, dateFormat: string): string {
|
||||
return this.datePipe.transform(timestamp, dateFormat);
|
||||
}
|
||||
|
||||
public parseDate(value: any): Date {
|
||||
if (value instanceof Array) {
|
||||
return moment(value.join('-'), 'YYYY-MM-DD').toDate();
|
||||
} else {
|
||||
return moment(value).toDate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user