Class NodaConverters
Convenience class to expose preconfigured converters for Noda Time types, and factory methods
for creating those which require parameters.
Since 1.0.x
Availability net6.0, netstandard2.0
Inherited Members
Namespace: NodaTime.Serialization.SystemTextJson
Assembly: NodaTime.Serialization.SystemTextJson.dll
Syntax
public static class NodaConverters
Properties
AnnualDateConverter
Converter for annual dates, using an ISO-8601 compatible pattern for the month and day parts.
Since 3.1.x
Availability net6.0, netstandard2.0
Declaration
public static JsonConverter<AnnualDate> AnnualDateConverter { get; }
Property Value
Type | Description |
---|---|
JsonConverter<AnnualDate> |
DateIntervalConverter
Converter for date intervals. This must be used in a serializer which also has a local date converter.
Since 1.0.x
Availability net6.0, netstandard2.0
Declaration
public static JsonConverter<DateInterval> DateIntervalConverter { get; }
Property Value
Type | Description |
---|---|
JsonConverter<DateInterval> |
DurationConverter
Converter for durations using JsonRoundtrip.
Since 1.0.x
Availability net6.0, netstandard2.0
Declaration
public static JsonConverter DurationConverter { get; }
Property Value
Type | Description |
---|---|
JsonConverter |
InstantConverter
Converter for instants, using the ISO-8601 date/time pattern, extended as required to accommodate milliseconds and ticks, and
specifying 'Z' at the end to show it's effectively in UTC.
Since 1.0.x
Availability net6.0, netstandard2.0
Declaration
public static JsonConverter<Instant> InstantConverter { get; }
Property Value
Type | Description |
---|---|
JsonConverter<Instant> |
IntervalConverter
Converter for intervals. This must be used in a serializer which also has an instant converter.
Since 1.0.x
Availability net6.0, netstandard2.0
Declaration
public static JsonConverter<Interval> IntervalConverter { get; }
Property Value
Type | Description |
---|---|
JsonConverter<Interval> |
IsoDateIntervalConverter
Converter for date intervals using ISO-8601 format, as defined by Iso.
Since 1.0.x
Availability net6.0, netstandard2.0
Declaration
public static JsonConverter<DateInterval> IsoDateIntervalConverter { get; }
Property Value
Type | Description |
---|---|
JsonConverter<DateInterval> |
IsoIntervalConverter
Converter for intervals using extended ISO-8601 format, as output by ToString().
Since 1.0.x
Availability net6.0, netstandard2.0
Declaration
public static JsonConverter<Interval> IsoIntervalConverter { get; }
Property Value
Type | Description |
---|---|
JsonConverter<Interval> |
LocalDateConverter
Converter for local dates, using the ISO-8601 date pattern.
Since 1.0.x
Availability net6.0, netstandard2.0
Declaration
public static JsonConverter<LocalDate> LocalDateConverter { get; }
Property Value
Type | Description |
---|---|
JsonConverter<LocalDate> |
LocalDateTimeConverter
Converter for local dates and times, using the ISO-8601 date/time pattern, extended as required to accommodate nanoseconds.
No time zone designator is applied.
Since 1.0.x
Availability net6.0, netstandard2.0
Declaration
public static JsonConverter<LocalDateTime> LocalDateTimeConverter { get; }
Property Value
Type | Description |
---|---|
JsonConverter<LocalDateTime> |
LocalTimeConverter
Converter for local times, using the ISO-8601 time pattern, extended as required to accommodate nanoseconds.
Since 1.0.x
Availability net6.0, netstandard2.0
Declaration
public static JsonConverter<LocalTime> LocalTimeConverter { get; }
Property Value
Type | Description |
---|---|
JsonConverter<LocalTime> |
NormalizingIsoPeriodConverter
Normalizing ISO converter for periods. Use this when you want compatibility with systems expecting
ISO durations (~= Noda Time periods). However, note that Noda Time can have negative periods. Note that
this converter loses information - after serialization and deserialization, "90 minutes" will become "an hour and 30 minutes".
Since 1.0.x
Availability net6.0, netstandard2.0
Declaration
public static JsonConverter<Period> NormalizingIsoPeriodConverter { get; }
Property Value
Type | Description |
---|---|
JsonConverter<Period> |
OffsetConverter
Converter for offsets.
Since 1.0.x
Availability net6.0, netstandard2.0
Declaration
public static JsonConverter<Offset> OffsetConverter { get; }
Property Value
Type | Description |
---|---|
JsonConverter<Offset> |
OffsetDateConverter
Converter for offset dates.
Since 1.0.x
Availability net6.0, netstandard2.0
Declaration
public static JsonConverter<OffsetDate> OffsetDateConverter { get; }
Property Value
Type | Description |
---|---|
JsonConverter<OffsetDate> |
OffsetDateTimeConverter
Converter for offset date/times.
Since 1.0.x
Availability net6.0, netstandard2.0
Declaration
public static JsonConverter<OffsetDateTime> OffsetDateTimeConverter { get; }
Property Value
Type | Description |
---|---|
JsonConverter<OffsetDateTime> |
OffsetTimeConverter
Converter for offset times.
Since 1.0.x
Availability net6.0, netstandard2.0
Declaration
public static JsonConverter<OffsetTime> OffsetTimeConverter { get; }
Property Value
Type | Description |
---|---|
JsonConverter<OffsetTime> |
RoundtripDurationConverter
Converter for durations using Roundtrip.
Since 3.2.x
Availability net6.0, netstandard2.0
Declaration
public static JsonConverter RoundtripDurationConverter { get; }
Property Value
Type | Description |
---|---|
JsonConverter |
RoundtripPeriodConverter
Round-tripping converter for periods. Use this when you really want to preserve information,
and don't need interoperability with systems expecting ISO.
Since 1.0.x
Availability net6.0, netstandard2.0
Declaration
public static JsonConverter<Period> RoundtripPeriodConverter { get; }
Property Value
Type | Description |
---|---|
JsonConverter<Period> |
Methods
CreateDateTimeZoneConverter(IDateTimeZoneProvider)
Creates a converter for time zones, using the given provider.
Since 1.0.x
Availability net6.0, netstandard2.0
Declaration
public static JsonConverter<DateTimeZone> CreateDateTimeZoneConverter(IDateTimeZoneProvider provider)
Parameters
Type | Name | Description |
---|---|---|
IDateTimeZoneProvider | provider | The time zone provider to use when parsing. |
Returns
Type | Description |
---|---|
JsonConverter<DateTimeZone> | A converter to handle DateTimeZone. |
CreateZonedDateTimeConverter(IDateTimeZoneProvider)
Creates a converter for zoned date/times, using the given time zone provider.
Since 1.0.x
Availability net6.0, netstandard2.0
Declaration
public static JsonConverter<ZonedDateTime> CreateZonedDateTimeConverter(IDateTimeZoneProvider provider)
Parameters
Type | Name | Description |
---|---|---|
IDateTimeZoneProvider | provider | The time zone provider to use when parsing. |
Returns
Type | Description |
---|---|
JsonConverter<ZonedDateTime> | A converter to handle ZonedDateTime. |