tlc.utils.datetime_helper

Module Contents

Classes

Class

Description

DateTimeHelper

A class with helper methods for working with timestamps

API

class tlc.utils.datetime_helper.DateTimeHelper

A class with helper methods for working with timestamps

static compare_timestamps(timestamp_1: str | datetime.datetime | None, timestamp_2: str | datetime.datetime) datetime.timedelta

Compare timestamps with time zone information.

The function parses the timestamps and computes a difference in seconds.

Parameters:
  • timestamp_1 – The first timestamp to compare.

  • timestamp_2 – The second timestamp to compare.

Returns:

The difference in seconds between the timestamps. A positive value indicates that timestamp_1 is later than timestamp_2.

Raises:

ValueError – if the timestamp is invalid.