Skip to main content

TimeConstraints

This class defines a set of temporal boundaries used to restrict or validate time-based data. It supports inclusive and exclusive upper and lower bounds, along with optional timezone constraints to ensure precise temporal comparisons.

Attributes

AttributeTypeDescription
leTimeSpecifies that the time must be less than or equal to this value.
ltTimeSpecifies that the time must be strictly less than this value.
geTimeSpecifies that the time must be greater than or equal to this value.
gtTimeSpecifies that the time must be strictly greater than this value.
tz[TZConstraint](../datetime/tzconstraint.md?sid=validators_datetime_tzconstraint)Defines the timezone constraint to be applied when evaluating time comparisons.

Constructor

Signature

def TimeConstraints(
le: Option< Time > = null,
lt: Option< Time > = null,
ge: Option< Time > = null,
gt: Option< Time > = null,
tz: Option< TZConstraint > = null
) - > null

Parameters

NameTypeDescription
leOption< Time > = nullLess than or equal to constraint
ltOption< Time > = nullLess than constraint
geOption< Time > = nullGreater than or equal to constraint
gtOption< Time > = nullGreater than constraint
tzOption< TZConstraint > = nullTimezone specific constraint

Methods


le()

def le(
le: Time
) - > [TimeConstraints](timeconstraints.md?sid=validators_time_timeconstraints)

Sets the 'less than or equal to' constraint for the time value.

Parameters

NameTypeDescription
leTimeThe maximum allowable time value, inclusive of the specified time.

Returns

TypeDescription
[TimeConstraints](timeconstraints.md?sid=validators_time_timeconstraints)The updated TimeConstraints instance with the upper bound inclusive limit applied.

lt()

def lt(
lt: Time
) - > [TimeConstraints](timeconstraints.md?sid=validators_time_timeconstraints)

Sets the 'less than' constraint for the time value.

Parameters

NameTypeDescription
ltTimeThe maximum allowable time value, excluding the specified time.

Returns

TypeDescription
[TimeConstraints](timeconstraints.md?sid=validators_time_timeconstraints)The updated TimeConstraints instance with the upper bound exclusive limit applied.

ge()

def ge(
ge: Time
) - > [TimeConstraints](timeconstraints.md?sid=validators_time_timeconstraints)

Sets the 'greater than or equal to' constraint for the time value.

Parameters

NameTypeDescription
geTimeThe minimum allowable time value, inclusive of the specified time.

Returns

TypeDescription
[TimeConstraints](timeconstraints.md?sid=validators_time_timeconstraints)The updated TimeConstraints instance with the lower bound inclusive limit applied.

gt()

def gt(
gt: Time
) - > [TimeConstraints](timeconstraints.md?sid=validators_time_timeconstraints)

Sets the 'greater than' constraint for the time value.

Parameters

NameTypeDescription
gtTimeThe minimum allowable time value, excluding the specified time.

Returns

TypeDescription
[TimeConstraints](timeconstraints.md?sid=validators_time_timeconstraints)The updated TimeConstraints instance with the lower bound exclusive limit applied.

tz()

def tz(
tz: [TZConstraint](../datetime/tzconstraint.md?sid=validators_datetime_tzconstraint)
) - > [TimeConstraints](timeconstraints.md?sid=validators_time_timeconstraints)

Applies a timezone constraint to the time comparison logic.

Parameters

NameTypeDescription
tz[TZConstraint](../datetime/tzconstraint.md?sid=validators_datetime_tzconstraint)The timezone constraint object defining how offsets or zones should be handled during validation.

Returns

TypeDescription
[TimeConstraints](timeconstraints.md?sid=validators_time_timeconstraints)The updated TimeConstraints instance configured with the specified timezone rules.