__init__

init_leap_cache

badidatetime.init_leap_cache()[source]

Initialize variables used to find Rata Die.

set_local_coordinates

badidatetime.set_local_coordinates(lat: float = None, lon: float = None, *, locale: str | int = '') None[source]

Either supply the latitude and longitude or the locale. If you supply the the latitude and longitude not network call is needed, the locale will cause a network call. If nothing is supplied the coordinents for Tehran will be used.

Parameters:
  • lat (float) – the latitude of your locale.

  • lon (float) – the longitude of your locale.

  • locale (str or int) – This is your city, street address, or zip code.

_local_timezone_info

badidatetime._local_timezone_info()[source]

Returns the offset in seconds, dst, IANA timezone key.

Returns:

Offset in seconds, True or False for dst, and the IANA key.

Return type:

tuple

Note

Currently this must use the Python built in datetime, because the tzlocal package does not work completely with the Badí’ datetime package.

_get_local_coordinates

badidatetime._get_local_coordinates() tuple | None[source]

Get the locales coordinates and timezone offset for generating the Rata Die.

Returns:

The latitude, longitude, and the offset in hours.

Return type:

tuple or None