Noda Time
Show / Hide Table of Contents

Class Resolvers

Commonly-used implementations of the delegates used in resolving a LocalDateTime to a ZonedDateTime, and a method to combine two "partial" resolvers into a full one.
Inheritance
Object
Resolvers
Inherited Members
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Namespace: NodaTime.TimeZones
Assembly: NodaTime.dll
Syntax
public static class Resolvers
Remarks

This class contains predefined implementations of ZoneLocalMappingResolver, AmbiguousTimeResolver, and SkippedTimeResolver, along with CreateMappingResolver(AmbiguousTimeResolver, SkippedTimeResolver), which produces a ZoneLocalMappingResolver from instances of the other two.

Fields

LenientResolver

A ZoneLocalMappingResolver which never throws an exception due to ambiguity or skipped time.
Declaration
public static readonly ZoneLocalMappingResolver LenientResolver
Field Value
Type Description
ZoneLocalMappingResolver
Remarks
Ambiguity is handled by returning the later occurrence, and skipped times are mapped to the start of the zone interval after the gap. This resolver combines ReturnLater and ReturnStartOfIntervalAfter.
See Also
AtLeniently(LocalDateTime)

ReturnEarlier

An AmbiguousTimeResolver which returns the earlier of the two matching times.
Declaration
public static readonly AmbiguousTimeResolver ReturnEarlier
Field Value
Type Description
AmbiguousTimeResolver
Remarks

This class contains predefined implementations of ZoneLocalMappingResolver, AmbiguousTimeResolver, and SkippedTimeResolver, along with CreateMappingResolver(AmbiguousTimeResolver, SkippedTimeResolver), which produces a ZoneLocalMappingResolver from instances of the other two.

ReturnEndOfIntervalBefore

A SkippedTimeResolver which returns the final tick of the time zone interval before the "gap".
Declaration
public static readonly SkippedTimeResolver ReturnEndOfIntervalBefore
Field Value
Type Description
SkippedTimeResolver
Remarks

This class contains predefined implementations of ZoneLocalMappingResolver, AmbiguousTimeResolver, and SkippedTimeResolver, along with CreateMappingResolver(AmbiguousTimeResolver, SkippedTimeResolver), which produces a ZoneLocalMappingResolver from instances of the other two.

ReturnLater

An AmbiguousTimeResolver which returns the later of the two matching times.
Declaration
public static readonly AmbiguousTimeResolver ReturnLater
Field Value
Type Description
AmbiguousTimeResolver
Remarks

This class contains predefined implementations of ZoneLocalMappingResolver, AmbiguousTimeResolver, and SkippedTimeResolver, along with CreateMappingResolver(AmbiguousTimeResolver, SkippedTimeResolver), which produces a ZoneLocalMappingResolver from instances of the other two.

ReturnStartOfIntervalAfter

A SkippedTimeResolver which returns the first tick of the time zone interval after the "gap".
Declaration
public static readonly SkippedTimeResolver ReturnStartOfIntervalAfter
Field Value
Type Description
SkippedTimeResolver
Remarks

This class contains predefined implementations of ZoneLocalMappingResolver, AmbiguousTimeResolver, and SkippedTimeResolver, along with CreateMappingResolver(AmbiguousTimeResolver, SkippedTimeResolver), which produces a ZoneLocalMappingResolver from instances of the other two.

StrictResolver

A ZoneLocalMappingResolver which only ever succeeds in the (usual) case where the result of the mapping is unambiguous.
Declaration
public static readonly ZoneLocalMappingResolver StrictResolver
Field Value
Type Description
ZoneLocalMappingResolver
Remarks
If the mapping is ambiguous or skipped, this throws SkippedTimeException or AmbiguousTimeException, as appropriate. This resolver combines ThrowWhenAmbiguous and ThrowWhenSkipped.
See Also
AtStrictly(LocalDateTime)

ThrowWhenAmbiguous

An AmbiguousTimeResolver which simply throws an AmbiguousTimeException.
Declaration
public static readonly AmbiguousTimeResolver ThrowWhenAmbiguous
Field Value
Type Description
AmbiguousTimeResolver
Remarks

This class contains predefined implementations of ZoneLocalMappingResolver, AmbiguousTimeResolver, and SkippedTimeResolver, along with CreateMappingResolver(AmbiguousTimeResolver, SkippedTimeResolver), which produces a ZoneLocalMappingResolver from instances of the other two.

ThrowWhenSkipped

A SkippedTimeResolver which simply throws a SkippedTimeException.
Declaration
public static readonly SkippedTimeResolver ThrowWhenSkipped
Field Value
Type Description
SkippedTimeResolver
Remarks

This class contains predefined implementations of ZoneLocalMappingResolver, AmbiguousTimeResolver, and SkippedTimeResolver, along with CreateMappingResolver(AmbiguousTimeResolver, SkippedTimeResolver), which produces a ZoneLocalMappingResolver from instances of the other two.

Methods

CreateMappingResolver(AmbiguousTimeResolver, SkippedTimeResolver)

Combines an AmbiguousTimeResolver and a SkippedTimeResolver to create a ZoneLocalMappingResolver.
Declaration
public static ZoneLocalMappingResolver CreateMappingResolver(AmbiguousTimeResolver ambiguousTimeResolver, SkippedTimeResolver skippedTimeResolver)
Parameters
Type Name Description
AmbiguousTimeResolver ambiguousTimeResolver Resolver to use for ambiguous mappings.
SkippedTimeResolver skippedTimeResolver Resolver to use for "skipped" mappings.
Returns
Type Description
ZoneLocalMappingResolver The logical combination of the two resolvers.
Remarks
The ZoneLocalMappingResolver created by this method operates in the obvious way: unambiguous mappings are returned directly, ambiguous mappings are delegated to the given AmbiguousTimeResolver, and "skipped" mappings are delegated to the given SkippedTimeResolver.
Exceptions
Type Condition
ArgumentNullException ambiguousTimeResolver or skippedTimeResolver is null.
In This Article
Back to top Generated by DocFX