Class NodaConverters
Convenience class to expose preconfigured converters for Noda Time types, and factory methods
for creating those which require parameters.
Since 1.2.x
Availability netstandard2.0
Inherited Members
Namespace: NodaTime.Serialization.JsonNet
Assembly: NodaTime.Serialization.JsonNet.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 netstandard2.0
Declaration
public static JsonConverter AnnualDateConverter { get; }
Property Value
Type | Description |
---|---|
JsonConverter |
DateIntervalConverter
Converter for date intervals. This must be used in a serializer which also has a local date converter.
Since 2.1.x
Availability netstandard2.0
Declaration
public static JsonConverter DateIntervalConverter { get; }
Property Value
Type | Description |
---|---|
JsonConverter |
DurationConverter
Converter for durations using JsonRoundtrip.
Since 1.2.x
Availability 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 nanoseconds, and
specifying 'Z' at the end to show it's effectively in UTC.
Since 1.2.x
Availability netstandard2.0
Declaration
public static JsonConverter InstantConverter { get; }
Property Value
Type | Description |
---|---|
JsonConverter |
IntervalConverter
Converter for intervals. This must be used in a serializer which also has an instant converter.
Since 1.2.x
Availability netstandard2.0
Declaration
public static JsonConverter IntervalConverter { get; }
Property Value
Type | Description |
---|---|
JsonConverter |
IsoDateIntervalConverter
Converter for date intervals using ISO-8601 format, as defined by Iso.
Since 2.1.x
Availability netstandard2.0
Declaration
public static JsonConverter IsoDateIntervalConverter { get; }
Property Value
Type | Description |
---|---|
JsonConverter |
IsoIntervalConverter
Converter for intervals using extended ISO-8601 format, as output by ToString().
Since 1.3.x
Availability netstandard2.0
Declaration
public static JsonConverter IsoIntervalConverter { get; }
Property Value
Type | Description |
---|---|
JsonConverter |
LocalDateConverter
Converter for local dates, using the ISO-8601 date pattern.
Since 1.2.x
Availability netstandard2.0
Declaration
public static JsonConverter LocalDateConverter { get; }
Property Value
Type | Description |
---|---|
JsonConverter |
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.2.x
Availability netstandard2.0
Declaration
public static JsonConverter LocalDateTimeConverter { get; }
Property Value
Type | Description |
---|---|
JsonConverter |
LocalTimeConverter
Converter for local times, using the ISO-8601 time pattern, extended as required to accommodate nanoseconds.
Since 1.2.x
Availability netstandard2.0
Declaration
public static JsonConverter LocalTimeConverter { get; }
Property Value
Type | Description |
---|---|
JsonConverter |
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.2.x
Availability netstandard2.0
Declaration
public static JsonConverter NormalizingIsoPeriodConverter { get; }
Property Value
Type | Description |
---|---|
JsonConverter |
OffsetConverter
Converter for offsets.
Since 1.2.x
Availability netstandard2.0
Declaration
public static JsonConverter OffsetConverter { get; }
Property Value
Type | Description |
---|---|
JsonConverter |
OffsetDateConverter
Converter for offset dates.
Since 2.2.x
Availability netstandard2.0
Declaration
public static JsonConverter OffsetDateConverter { get; }
Property Value
Type | Description |
---|---|
JsonConverter |
OffsetDateTimeConverter
Converter for offset date/times.
Since 1.2.x
Availability netstandard2.0
Declaration
public static JsonConverter OffsetDateTimeConverter { get; }
Property Value
Type | Description |
---|---|
JsonConverter |
OffsetTimeConverter
Converter for offset times.
Since 2.2.x
Availability netstandard2.0
Declaration
public static JsonConverter OffsetTimeConverter { get; }
Property Value
Type | Description |
---|---|
JsonConverter |
RoundtripDurationConverter
Converter for durations using Roundtrip.
Since 3.2.x
Availability 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.2.x
Availability netstandard2.0
Declaration
public static JsonConverter RoundtripPeriodConverter { get; }
Property Value
Type | Description |
---|---|
JsonConverter |
Methods
CreateDateTimeZoneConverter(IDateTimeZoneProvider)
Creates a converter for time zones, using the given provider.
Since 1.2.x
Availability netstandard2.0
Declaration
public static JsonConverter CreateDateTimeZoneConverter(IDateTimeZoneProvider provider)
Parameters
Type | Name | Description |
---|---|---|
IDateTimeZoneProvider | provider | The time zone provider to use when parsing. |
Returns
Type | Description |
---|---|
JsonConverter | A converter to handle DateTimeZone. |
CreateZonedDateTimeConverter(IDateTimeZoneProvider)
Creates a converter for zoned date/times, using the given time zone provider.
Since 1.2.x
Availability netstandard2.0
Declaration
public static JsonConverter CreateZonedDateTimeConverter(IDateTimeZoneProvider provider)
Parameters
Type | Name | Description |
---|---|---|
IDateTimeZoneProvider | provider | The time zone provider to use when parsing. |
Returns
Type | Description |
---|---|
JsonConverter | A converter to handle ZonedDateTime. |