I'm using .net Core 2.1, For serializing dates i'm using newtonsoft, Client side i'm using moment and knockout
So how do you cleanly go about setting up your site so dates can be sent back and forth and also always displayed in a friendly format?
I want the display to always be a variant of dd/MM/yyyy HH:mm:ss. Sometimes I will not be displaying the time.
Ultimately whenever i get or send a date back i get it in UK and the other end sees it as US (MM/dd/yyyy) etc.
I'm happy to work with dates on the server as ISO8601, i'm just stumped having to create new moments everywhere, specify incoming and out going formats all over the place. I'm clearly not doing it right.
These are my current serializer settings.
JsonSerializerSettings settings = new JsonSerializerSettings();
settings.Culture = new System.Globalization.CultureInfo("en-GB");
settings.DateFormatString = "dd/MM/yyyy HH:mm:ss";
settings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
JsonConvert.DefaultSettings = () => settings;
I'm just not succeeding in keeping the format consistent.