nodatime / nodatime.serialization

Serialization projects for Noda Time

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Request for NodaTime.OffsetDate converting

artfulsage opened this issue · comments

Hi. Please add converter for NodaTime.OffsetDate to ConfigureForNodaTime() extension methods.

That seems doable - with OffsetTime at the same time. For the moment, it should be easy enough to work around with a suitable NodaPatternConverter.

Sample for those who also needs this for now

var settings = new JsonSerializerSettings();
settings.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
settings.Converters.Add(new NodaPatternConverter<OffsetDate>(OffsetDatePattern.GeneralIso));

This is now part of 2.2.0-beta01