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
| Attribute | Type | Description |
|---|---|---|
| le | Time | Specifies that the time must be less than or equal to this value. |
| lt | Time | Specifies that the time must be strictly less than this value. |
| ge | Time | Specifies that the time must be greater than or equal to this value. |
| gt | Time | Specifies 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
| Name | Type | Description |
|---|---|---|
| le | Option< Time > = null | Less than or equal to constraint |
| lt | Option< Time > = null | Less than constraint |
| ge | Option< Time > = null | Greater than or equal to constraint |
| gt | Option< Time > = null | Greater than constraint |
| tz | Option< TZConstraint > = null | Timezone 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
| Name | Type | Description |
|---|---|---|
| le | Time | The maximum allowable time value, inclusive of the specified time. |
Returns
| Type | Description |
|---|---|
[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
| Name | Type | Description |
|---|---|---|
| lt | Time | The maximum allowable time value, excluding the specified time. |
Returns
| Type | Description |
|---|---|
[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
| Name | Type | Description |
|---|---|---|
| ge | Time | The minimum allowable time value, inclusive of the specified time. |
Returns
| Type | Description |
|---|---|
[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
| Name | Type | Description |
|---|---|---|
| gt | Time | The minimum allowable time value, excluding the specified time. |
Returns
| Type | Description |
|---|---|
[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
| Name | Type | Description |
|---|---|---|
| tz | [TZConstraint](../datetime/tzconstraint.md?sid=validators_datetime_tzconstraint) | The timezone constraint object defining how offsets or zones should be handled during validation. |
Returns
| Type | Description |
|---|---|
[TimeConstraints](timeconstraints.md?sid=validators_time_timeconstraints) | The updated TimeConstraints instance configured with the specified timezone rules. |