Format date fields without patch form

This commit is contained in:
Jose Alberto Hernandez
2022-06-10 10:34:19 +02:00
committed by Arnold Gálovics
parent 9d43181cea
commit 6ea3d97538
191 changed files with 1408 additions and 1173 deletions
@@ -2,11 +2,11 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
import { DatePipe } from '@angular/common';
/** Custom Services */
import { AccountTransfersService } from '../account-transfers.service';
import { SettingsService } from 'app/settings/settings.service';
import { Dates } from 'app/core/utils/dates';
/**
* Create Standing Instructions
@@ -70,14 +70,14 @@ export class CreateStandingInstructionsComponent implements OnInit {
* @param {Router} router Router
* @param {AccountTransfersService} accountTransfersService Account Transfers Service
* @param {SettingsService} settingsService Settings Service
* @param {DatePipe} datePipe Date Pipe
* @param {Dates} dateUtils Date Utils
*/
constructor(private formBuilder: FormBuilder,
private route: ActivatedRoute,
private router: Router,
private accountTransfersService: AccountTransfersService,
private settingsService: SettingsService,
private datePipe: DatePipe) {
private dateUtils: Dates) {
this.route.data.subscribe((data: { standingIntructionsTemplate: any }) => {
this.standingIntructionsTemplate = data.standingIntructionsTemplate;
this.setParams();
@@ -221,9 +221,9 @@ export class CreateStandingInstructionsComponent implements OnInit {
monthDayFormat: 'dd MMMM',
fromClientId: this.clientId,
fromOfficeId: this.officeId,
validFrom: this.datePipe.transform(this.createStandingInstructionsForm.value.validFrom, dateFormat),
validTill: this.datePipe.transform(this.createStandingInstructionsForm.value.validTill, dateFormat),
recurrenceOnMonthDay: this.datePipe.transform(this.createStandingInstructionsForm.value.recurrenceOnMonthDay, 'dd MMMM'),
validFrom: this.dateUtils.formatDate(this.createStandingInstructionsForm.value.validFrom, dateFormat),
validTill: this.dateUtils.formatDate(this.createStandingInstructionsForm.value.validTill, dateFormat),
recurrenceOnMonthDay: this.dateUtils.formatDate(this.createStandingInstructionsForm.value.recurrenceOnMonthDay, 'dd MMMM'),
};
delete standingInstructionData['destination'];
delete standingInstructionData['applicant'];
@@ -2,11 +2,11 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
import { DatePipe } from '@angular/common';
/** Custom Services */
import { AccountTransfersService } from '../account-transfers.service';
import { SettingsService } from 'app/settings/settings.service';
import { Dates } from 'app/core/utils/dates';
/**
* Edit Standing Instructions
@@ -48,14 +48,14 @@ export class EditStandingInstructionsComponent implements OnInit {
* @param {Router} router Router
* @param {AccountTransfersService} accountTransfersService Account Transfers Service
* @param {SettingsService} settingsService Settings Service
* @param {DatePipe} datePipe Date Pipe
* @param {Dates} dateUtils Date Utils
*/
constructor(private formBuilder: FormBuilder,
private route: ActivatedRoute,
private router: Router,
private accountTransfersService: AccountTransfersService,
private settingsService: SettingsService,
private datePipe: DatePipe) {
private dateUtils: Dates) {
this.route.data.subscribe((data: { standingInstructionsDataAndTemplate: any }) => {
this.standingInstructionsData = data.standingInstructionsDataAndTemplate;
this.standingInstructionsId = data.standingInstructionsDataAndTemplate.id;
@@ -151,11 +151,11 @@ export class EditStandingInstructionsComponent implements OnInit {
priority: this.editStandingInstructionsForm.value.priority,
recurrenceFrequency: this.editStandingInstructionsForm.value.recurrenceFrequency,
recurrenceInterval: this.editStandingInstructionsForm.value.recurrenceInterval,
recurrenceOnMonthDay: this.datePipe.transform(this.editStandingInstructionsForm.value.recurrenceOnMonthDay, 'dd MMMM'),
recurrenceOnMonthDay: this.dateUtils.formatDate(this.editStandingInstructionsForm.value.recurrenceOnMonthDay, 'dd MMMM'),
recurrenceType: this.editStandingInstructionsForm.value.recurrenceType,
status: this.editStandingInstructionsForm.value.status,
validFrom: this.datePipe.transform(this.editStandingInstructionsForm.value.validFrom, dateFormat),
validTill: this.datePipe.transform(this.editStandingInstructionsForm.value.validTill, dateFormat)
validFrom: this.dateUtils.formatDate(this.editStandingInstructionsForm.value.validFrom, dateFormat),
validTill: this.dateUtils.formatDate(this.editStandingInstructionsForm.value.validTill, dateFormat)
};
this.accountTransfersService.updateStandingInstructionsData(this.standingInstructionsId, standingInstructionData).subscribe((response: any) => {
this.router.navigate(['../view'], { relativeTo: this.route });
@@ -2,12 +2,12 @@
import { Component, OnInit, AfterViewInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { DatePipe } from '@angular/common';
/** Custom Services */
import { AccountTransfersService } from '../account-transfers.service';
import { SettingsService } from 'app/settings/settings.service';
import { ClientsService } from 'app/clients/clients.service';
import { Dates } from 'app/core/utils/dates';
/**
@@ -51,7 +51,7 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
* @param {FormBuilder} formBuilder Form Builder
* @param {Router} router Router
* @param {AccountTransfersService} accountTransfersService Account Transfers Service
* @param {DatePipe} datePipe Date Pipe
* @param {Dates} dateUtils Date Utils
* @param {SettingsService} settingsService Settings Service
* @param {ClientsService} clientsService Clients Service
*/
@@ -59,7 +59,7 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
private route: ActivatedRoute,
private router: Router,
private accountTransfersService: AccountTransfersService,
private datePipe: DatePipe,
private dateUtils: Dates,
private settingsService: SettingsService,
private clientsService: ClientsService) {
this.route.data.subscribe((data: { accountTransferTemplate: any }) => {
@@ -176,7 +176,7 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
const locale = this.settingsService.language.code;
const makeAccountTransferData = {
... this.makeAccountTransferForm.value,
transferDate: this.datePipe.transform(this.makeAccountTransferForm.value.transferDate, dateFormat),
transferDate: this.dateUtils.formatDate(this.makeAccountTransferForm.value.transferDate, dateFormat),
dateFormat,
locale,
toClientId: this.makeAccountTransferForm.controls.toClientId.value.id,