Move out DatePipe to use in one place Dates
This commit is contained in:
@@ -46,7 +46,6 @@ export class CodesComponent implements OnInit {
|
||||
*/
|
||||
setCodes() {
|
||||
this.dataSource = new MatTableDataSource(this.codesData);
|
||||
console.log(this.codesData);
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sort = this.sort;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { DatePipe } from '@angular/common';
|
||||
|
||||
/** Custom Services */
|
||||
import { SystemService } from 'app/system/system.service';
|
||||
@@ -18,6 +17,7 @@ import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-
|
||||
import { SelectBase } from 'app/shared/form-dialog/formfield/model/select-base';
|
||||
import { DatepickerBase } from 'app/shared/form-dialog/formfield/model/datepicker-base';
|
||||
import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
|
||||
/**
|
||||
* Entity to Entity Mapping Component
|
||||
@@ -82,7 +82,7 @@ export class EntityToEntityMappingComponent implements OnInit {
|
||||
constructor(private route: ActivatedRoute,
|
||||
private formBuilder: FormBuilder,
|
||||
private systemService: SystemService,
|
||||
private datePipe: DatePipe,
|
||||
private dateUtils: Dates,
|
||||
private dialog: MatDialog,
|
||||
private settingsService: SettingsService) {
|
||||
this.route.data.subscribe((data: { entityMappings: any }) => {
|
||||
@@ -320,11 +320,10 @@ export class EntityToEntityMappingComponent implements OnInit {
|
||||
const startDate: Date = addMappingForm.value.startDate;
|
||||
const endDate: Date = addMappingForm.value.endDate;
|
||||
|
||||
addMappingForm.patchValue({
|
||||
startDate: this.datePipe.transform(startDate, dateFormat),
|
||||
endDate: this.datePipe.transform(endDate, dateFormat)
|
||||
});
|
||||
const newMappingData = addMappingForm.value;
|
||||
newMappingData.startDate = this.dateUtils.formatDate(startDate, dateFormat);
|
||||
newMappingData.endDate = this.dateUtils.formatDate(endDate, dateFormat);
|
||||
|
||||
newMappingData.dateFormat = dateFormat;
|
||||
newMappingData.locale = this.settingsService.language.code;
|
||||
this.systemService.createMapping(this.relId, newMappingData).subscribe((response: any) => {
|
||||
@@ -342,11 +341,10 @@ export class EntityToEntityMappingComponent implements OnInit {
|
||||
const startDate: Date = editMappingForm.value.startDate;
|
||||
const endDate: Date = editMappingForm.value.endDate;
|
||||
|
||||
editMappingForm.patchValue({
|
||||
startDate: this.datePipe.transform(startDate, dateFormat),
|
||||
endDate: this.datePipe.transform(endDate, dateFormat)
|
||||
});
|
||||
const newMappingData = editMappingForm.value;
|
||||
newMappingData.startDate = this.dateUtils.formatDate(startDate, dateFormat);
|
||||
newMappingData.endDate = this.dateUtils.formatDate(endDate, dateFormat);
|
||||
|
||||
newMappingData.dateFormat = dateFormat;
|
||||
newMappingData.locale = this.settingsService.language.code;
|
||||
this.systemService.editMapping(this.mapIdToEdit, newMappingData).subscribe((response: any) => {
|
||||
|
||||
Reference in New Issue
Block a user