Skip to main content

remaining

Calculate the real remaining time for a start date and a timedelta.

def remaining(
start: datetime,
ends_in: timedelta,
now: datetime | None = None,
relative: boolean = False
) - > timedelta

Calculate the real remaining time for a start date and a timedelta.

Parameters

NameTypeDescription
startdatetimeThe initial starting date and time from which the duration is measured.
ends_intimedeltaThe duration to add to the start date to determine the expiration point.
now`datetimeNone` = None
relativeboolean = FalseIf enabled, the end time will be calculated using delta_resolution and rounded to the resolution of ends_in.

Returns

TypeDescription
timedeltaThe remaining time duration until the calculated end date is reached.