Skip to main content

py-time-between Build Status

Ordinary package to say if a time variable falls between two given times.

Motivation: I was working in a test to a job opening, and I needed it, but I did not want google this. I know that exists a lot of code like this.

Usage:

is_time_between(testing_time, start_time_inclusive, end_time_inclusive)

from datetime import time
from timebetween import is_time_between


def test_is_time_between():
    t, s, e = time(0), time(0), time(0)
    assert is_time_between(t, s, e)

    t, s, e = time(0, 0, 0, 1), time(0), time(0, 0, 0, 2)
    assert is_time_between(t, s, e)

    t, s, e = time(0, 0, 0, 1), time(0, 0, 0, 1), time(0, 0, 0, 2)
    assert is_time_between(t, s, e)

    t, s, e = time(0, 0, 0, 2), time(0, 0, 0, 1), time(0, 0, 0, 2)
    assert is_time_between(t, s, e)

    t, s, e = time(0, 0, 1), time(23, 59, 59), time(0, 0, 2)
    assert is_time_between(t, s, e)

    t, s, e = time(12, 0, 0), time(23, 59, 59), time(0, 0, 0)
    assert is_time_between(t, s, e)

    t, s, e = time(23, 59, 57), time(23, 59, 59), time(23, 59, 57)
    assert is_time_between(t, s, e)

    t, s, e = time(23, 59, 58), time(23, 59, 59), time(23, 59, 57)
    assert not is_time_between(t, s, e)

    t, s, e = time(22), time(22), time(5, 59, 59)
    assert is_time_between(t, s, e)

    # Hey, did you see a uncovered test case?
    # Please, open a PR.

Metadata

Release files for py-time-between 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-time-between 0.1.2
File Size Uploaded
py-time-between-0.1.2.tar.gz 1.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for py-time-between 0.1.2
File Interpreter ABI Platform
py_time_between-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 4.6 kB

Release files / py-time-between-0.1.2.tar.gz

Download URL py-time-between-0.1.2.tar.gz
Size 1.9 kB
Tags Source
SHA-256 checksum
How to use checksums
23c2fc4dcae350a6b35d8d1adae2351a1277844837ded3287dc004df2c5fa708
BLAKE2b-256 checksum
How to use checksums
41a1e6b661a4b9c236d2bbabf0b874fe9f7c704687fed108c9b0af0e19495cb3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.6

Release files / py_time_between-0.1.2-py3-none-any.whl

Download URL py_time_between-0.1.2-py3-none-any.whl
Size 2.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
073533cb24c793e7fce4b522ceeddea411ac50323b113ff8f3afa1934a8a6700
BLAKE2b-256 checksum
How to use checksums
5dde5aa4af0b05e3ee9a718138ad5faa1672b75a6685170e094045fdbb9e9ef1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.6

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page