Skip to main content

TimeValidator

This class provides functionality for validating time-related data based on configurable strictness and specific constraints. It manages precision behavior for microsecond overflows and allows for the enforcement of custom time limits through an optional constraints interface.

Attributes

AttributeTypeDescription
strictboolDetermines whether the validator enforces strict time format adherence or allows for more flexible parsing.
constraintsOption< TimeConstraints > = NoneOptional set of rules that define the valid range or specific limitations for time values.
microseconds_precisionMicrosecondsPrecisionOverflowBehaviorDefines how the validator handles sub-microsecond data and overflow behavior during time resolution.

Constructor

Signature

def TimeValidator(
strict: bool,
constraints: Option< TimeConstraints >,
microseconds_precision: MicrosecondsPrecisionOverflowBehavior
) - > null

Parameters

NameTypeDescription
strictboolWhether to enforce strict validation rules.
constraintsOption< TimeConstraints >Optional constraints to apply to the time validation.
microseconds_precisionMicrosecondsPrecisionOverflowBehaviorBehavior for handling microsecond precision overflow.

Signature

@staticmethod
def new(
strict: bool,
constraints: Option< TimeConstraints >,
microseconds_precision: MicrosecondsPrecisionOverflowBehavior
) - > [TimeValidator](timevalidator.md?sid=validators_time_timevalidator)

Parameters

NameTypeDescription
strictboolWhether to enforce strict validation rules during time parsing.
constraintsOption< TimeConstraints >Optional range constraints or specific limits to apply to validated time values.
microseconds_precisionMicrosecondsPrecisionOverflowBehaviorDefines how the validator handles microsecond precision and potential overflow scenarios.