Move out DatePipe to use in one place Dates
This commit is contained in:
+4
-4
@@ -2,12 +2,12 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { DatePipe } from '@angular/common';
|
||||
|
||||
/** Custom Services */
|
||||
import { LoansService } from 'app/loans/loans.service';
|
||||
import { ConfirmationDialogComponent } from 'app/shared/confirmation-dialog/confirmation-dialog.component';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
|
||||
/** Custom Dialogs */
|
||||
|
||||
@@ -31,12 +31,12 @@ export class ViewTransactionComponent {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {MatDialog} dialog Dialog reference.
|
||||
* @param {DatePipe} datePipe DatePipe.
|
||||
* @param {Dates} dateUtils Date Utils.
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
*/
|
||||
constructor(private loansService: LoansService,
|
||||
private route: ActivatedRoute,
|
||||
private datePipe: DatePipe,
|
||||
private dateUtils: Dates,
|
||||
private router: Router,
|
||||
public dialog: MatDialog,
|
||||
private settingsService: SettingsService) {
|
||||
@@ -58,7 +58,7 @@ export class ViewTransactionComponent {
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const data = {
|
||||
transactionDate: this.datePipe.transform(this.transactionData.date && new Date(this.transactionData.date), dateFormat),
|
||||
transactionDate: this.dateUtils.formatDate(this.transactionData.date && new Date(this.transactionData.date), dateFormat),
|
||||
transactionAmount: 0,
|
||||
dateFormat,
|
||||
locale
|
||||
|
||||
Reference in New Issue
Block a user