It seems I can't save "random" dates in my DB via Linq Query. I've followed this guide (JsonConvert.DeserializeObject could not convert string to DateTime when using non-us date formats) and the specific code is:
var format = "dd/MM/yyyy"; // your datetime format
var dateTimeConverter = new IsoDateTimeConverter { DateTimeFormat = format };
var ld = JsonConvert.DeserializeObject<Model>(jsonString, dateTimeConverter);
If my jsonString was {date: 12/5/2020}
then it works, but for {date: 23/5/2020}
or even {date: 30/5/2020}
, it doesn't.
It feels very inconsistent as these are "random" dates that seem to work and not work, I can't even pinpoint why some are working and some are not.
I know this is a very vague question, but is there something I'm overlooking as to why these dates appear to not be saving?
Specific error:
summary response: Could not insert into database: Could not convert string to DateTime: 23/5/2020.
But if the date was 12/5/2020, saves successfully.