I am new to Angular
and trying to pass date from the angular component to MVC API(C#)
date time. Looks like I am not getting default time stamp 12:00 am in API
method. Let me know what I am doing wrong.
Client Model:
export class TestClass {
constructor(
public ctyName: string = '',
public stateName: string = '',
public zipCode: string = '',
public country: string = '',
public effectiveDate: Date = null
) {
}
}
Service Model
public class TestClass
{
public string CityName { get; set; }
public string StateName { get; set; }
public string ZipCode { get; set; }
public string Country { get; set; }
public DateTime EffectiveDate: { get; set; }
}
Client Method - Assignment
var month = '1';
var day = '1';
var year = '2016';
effectiveDate = new Date(year, month - 1, day);
Api Method
[HttpPost("[action]/{id}")]
public PostResult UpdateData(string id, [FromBody]TestClass testClass)
{
}
Value I am receiving in API
2016-01-01 05:00:00.000
Thanks for your time