json.net - c# Newtonsoft DateTimeZoneHandling.RoundtripKind not working -
i have code in webapiconfig file serialize data:
public static void register(httpconfiguration config) { config.enablecors(); config.maphttpattributeroutes(); config.filters.add(new dbvalidationerrorattribute()); config.filters.add(new validationfailederrorattribute()); config.filters.add(new genericexceptionfilterattribute()); var jsonformatter = config.formatters.jsonformatter; var jsettings = new newtonsoft.json.jsonserializersettings() { dateformathandling = dateformathandling.isodateformat, dateparsehandling = dateparsehandling.datetimeoffset, datetimezonehandling = datetimezonehandling.roundtripkind }; jsonformatter.serializersettings = jsettings; config.services.replace(typeof(icontentnegotiator), new jsoncontentnegotiator(jsonformatter)); }
it webapi. controller gets data frontend. problem dates. have different timezone server timezone , converted server timezone. tryed lot of different options in jsonserializersettings. none of them worked. downloaded last newtonsoft version.
any avoid timezone conversion?
Comments
Post a Comment