I'm currently in the process of testing a function by passing a date as a parameter, but I seem to be encountering an issue that I can't quite figure out. When structured like this, it throws an error stating "Argument of type 'number' is not assignable to parameter of type 'Date'.":
import { Component, OnInit } from '@angular/core';
import { DamageAssessmentReportService } from 'src/app/damage-assessment-report.service';
@Component({
selector: 'app-fa-daform',
templateUrl: './fa-daform.component.html',
styleUrls: ['./fa-daform.component.css']
})
export class FADAFormComponent implements OnInit {
constructor(private damageAssessmentReportService : DamageAssessmentReportService) { }
//assessmentDescription: string, author: string, reportDateTime: Date
createNewDAReport(){
this.damageAssessmentReportService.createDAReport('Testing1','Testing2', 2022-10-10).subscribe(()=>{
})
}
ngOnInit(): void {
}
}
When the code is modified to the following structure, the error changes to "Argument of type 'string' is not assignable to parameter of type 'Date'.ts(2345)":
import { Component, OnInit } from '@angular/core';
import { DamageAssessmentReportService } from 'src/app/damage-assessment-report.service';
@Component({
selector: 'app-fa-daform',
templateUrl: './fa-daform.component.html',
styleUrls: ['./fa-daform.component.css']
})
export class FADAFormComponent implements OnInit {
constructor(private damageAssessmentReportService : DamageAssessmentReportService) { }
//assessmentDescription: string, author: string, reportDateTime: Date
createNewDAReport(){
this.damageAssessmentReportService.createDAReport('Testing1','Testing2', '2022-10-10').subscribe(()=>{
})
}
ngOnInit(): void {
}
}