I am working on a large system that is using C# Web API 2 and Angular 12 on the front-end. Dates that are coming in via Oracle to C# are true dates in both systems (not strings).
They come across in the format "2021-11-10T10:48:38", which is showing typeof() as string into Angular even though we have these in TypeScript as Date in the interface.
When any JS date operations are attempted on these date objects, they fail, although the front-end compiler doesn't catch them because it assumes they are Date types due to the interface. So it fails at run-time.
What is the best way to handle this on the C# side? I can do ourDate = new Date(ourDate) on the Angular side, which does work, but is not reasonable to do this everywhere we call the API.
I apologize for all the tags but I'm not sure where I should attack this from, I assume in the JSON serialization step on the server.