/// <summary> /// Configures the <see cref="ZonedDateTime" /> serializer to use a format compatible /// with the ToString method. /// </summary> /// <param name="serializerSettings">The existing serializer settings to add Noda Time serializerSettings to.</param> /// <returns>The original <param ref="serializerSettings" /> value, for further chaining.</returns> public static INodaSerializerSettings WithGeneralIsoZonedDateTimeSerializer( this INodaSerializerSettings serializerSettings) { serializerSettings.SetSerializer( x => x.ZonedDateTimeSerializer = NodaSerializerDefinitions.CreateZonedDateTimeSerializer(x.Provider, ZonedDateTimePattern.GeneralFormatOnlyIso.PatternText)); return(serializerSettings); }
/// <summary> /// Creates an instance of default serializers using the given <see cref="IDateTimeZoneProvider"/>. /// </summary> /// <param name="provider"></param> public DefaultNodaSerializerSettings(IDateTimeZoneProvider provider) { if (provider == null) { throw new ArgumentNullException("provider"); } DurationSerializer = NodaSerializerDefinitions.DurationSerializer; DateTimeZoneSerializer = NodaSerializerDefinitions.CreateDateTimeZoneSerializer(provider); InstantSerializer = NodaSerializerDefinitions.InstantSerializer; IntervalSerializer = NodaSerializerDefinitions.ComplexIntervalSerializer; LocalDateSerializer = NodaSerializerDefinitions.LocalDateSerializer; LocalDateTimeSerializer = NodaSerializerDefinitions.LocalDateTimeSerializer; LocalTimeSerializer = NodaSerializerDefinitions.LocalTimeSerializer; OffsetSerializer = NodaSerializerDefinitions.OffsetSerializer; OffsetDateTimeSerializer = NodaSerializerDefinitions.OffsetDateTimeSerializer; PeriodSerializer = NodaSerializerDefinitions.RoundtripPeriodSerializer; ZonedDateTimeSerializer = NodaSerializerDefinitions.CreateZonedDateTimeSerializer(provider); Provider = provider; }