Move out DatePipe to use in one place Dates

This commit is contained in:
Jose Alberto Hernandez
2022-06-29 14:34:01 -05:00
parent 5bc9f0dac0
commit 5eeaed3ee9
75 changed files with 295 additions and 287 deletions
@@ -1,7 +1,6 @@
/** Angular Imports */
import { Component, ViewChild } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { DatePipe } from '@angular/common';
/** Custom Components */
import { SharesAccountDetailsStepComponent } from '../shares-account-stepper/shares-account-details-step/shares-account-details-step.component';
@@ -11,6 +10,7 @@ import { SharesAccountChargesStepComponent } from '../shares-account-stepper/sha
/** Custom Services */
import { SharesService } from '../shares.service';
import { SettingsService } from 'app/settings/settings.service';
import { Dates } from 'app/core/utils/dates';
/**
* Create Shares Account Component
@@ -38,13 +38,13 @@ export class CreateSharesAccountComponent {
* Fetches shares account template from `resolve`
* @param {ActivatedRoute} route Activated Route
* @param {Router} router Router
* @param {DatePipe} datePipe Date Utils
* @param {Dates} dateUtils Date Utils
* @param {SharesService} sharesService Shares Service
* @param {SettingsService} settingsService Settings Service
*/
constructor(private route: ActivatedRoute,
private router: Router,
private datePipe: DatePipe,
private dateUtils: Dates,
private sharesService: SharesService,
private settingsService: SettingsService) {
this.route.data.subscribe((data: { sharesAccountTemplate: any }) => {
@@ -106,8 +106,8 @@ export class CreateSharesAccountComponent {
...this.sharesAccount,
clientId: this.sharesAccountTemplate.clientId,
charges: this.sharesAccount.charges.map((charge: any) => ({ chargeId: charge.chargeId, amount: charge.amount })),
applicationDate: this.datePipe.transform(this.sharesAccount.applicationDate, dateFormat),
submittedDate: this.datePipe.transform(this.sharesAccount.submittedDate, dateFormat),
applicationDate: this.dateUtils.formatDate(this.sharesAccount.applicationDate, dateFormat),
submittedDate: this.dateUtils.formatDate(this.sharesAccount.submittedDate, dateFormat),
unitPrice: this.sharesAccountTermsForm.get('unitPrice').value,
dateFormat,
locale
@@ -1,7 +1,6 @@
/** Angular Imports */
import { Component, ViewChild } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { DatePipe } from '@angular/common';
/** Custom Components */
import { SharesAccountDetailsStepComponent } from '../shares-account-stepper/shares-account-details-step/shares-account-details-step.component';
@@ -11,6 +10,7 @@ import { SharesAccountChargesStepComponent } from '../shares-account-stepper/sha
/** Custom Services */
import { SharesService } from '../shares.service';
import { SettingsService } from 'app/settings/settings.service';
import { Dates } from 'app/core/utils/dates';
/**
* Edit Shares Account Component
@@ -38,13 +38,13 @@ export class EditSharesAccountComponent {
* Fetches shares account template from `resolve`
* @param {ActivatedRoute} route Activated Route
* @param {Router} router Router
* @param {DatePipe} datePipe Date Utils
* @param {Dates} dateUtils Date Utils
* @param {SharesService} sharesService Shares Service
* @param {SettingsService} settingsService Settings Service
*/
constructor(private route: ActivatedRoute,
private router: Router,
private datePipe: DatePipe,
private dateUtils: Dates,
private sharesService: SharesService,
private settingsService: SettingsService) {
this.route.data.subscribe((data: { sharesAccountAndTemplate: any }) => {
@@ -111,8 +111,8 @@ export class EditSharesAccountComponent {
...this.sharesAccount,
clientId: this.sharesAccountAndTemplate.clientId,
charges: this.sharesAccount.charges.map((charge: any) => ({ chargeId: charge.chargeId, amount: charge.amount })),
applicationDate: this.datePipe.transform(this.sharesAccount.applicationDate, dateFormat),
submittedDate: this.datePipe.transform(this.sharesAccount.submittedDate, dateFormat),
applicationDate: this.dateUtils.formatDate(this.sharesAccount.applicationDate, dateFormat),
submittedDate: this.dateUtils.formatDate(this.sharesAccount.submittedDate, dateFormat),
unitPrice: this.sharesAccountTermsForm.get('unitPrice').value,
dateFormat,
locale
+1 -2
View File
@@ -1,6 +1,5 @@
/** Angular Imports */
import { NgModule } from '@angular/core';
import { DatePipe } from '@angular/common';
/** Custom Modules */
import { SharesRoutingModule } from './shares-routing.module';
@@ -66,6 +65,6 @@ import { RejectShareDialogComponent } from './shares-account-actions/reject-shar
RejectSharesComponent,
RejectShareDialogComponent
],
providers: [DatePipe]
providers: [ ]
})
export class SharesModule { }