I have a JSON call from an object:
public record SaveDate(DateOnly StartDate, string EndDate, Object[] objects);
var saveDate= new SaveDate(DateOnly.MinValue, DateTime.MaxValue.ToString("yyyy-MM-dd"),
new Object[] { objects});
that when executes the API call it ends up returning
{
"startDate": {
"year": 1,
"month": 1,
"day": 1,
"dayOfWeek": 1,
"dayOfYear": 1,
"dayNumber": 0
},
"endDate": "2022-07-07",
"Object": [
{
"foo": "bar"
}
]
}
]
}
however I need to have the format sent from startDate to be the same as endDate ("yyyy-MM-dd") instead of the deserialized version. how can I do that?
note: I'm using DateOnly as type (.net 6.0) and the API expects a string in the format specified above.