bridgetime (Python)
BridgeTime is a Rust-powered datetime toolkit with a Day.js/Moment-style API exposed to Python.
Install
pip install bridgetime
Quickstart
from bridgetime import bridge_duration, bridge_time, supported_locales, supported_units
now = bridge_time.now("UTC")
print(now.to_iso())
custom = bridge_time.parse_format("22/02/2026 10:15", "DD/MM/YYYY HH:mm", "UTC")
print(custom.to_iso())
from_array = bridge_time.from_array([2026, 1, 22, 10, 15, 30, 250], "UTC")
print(from_array.to_array())
duration = bridge_duration(90, "minute")
print(duration.humanize(True)) # in 2 hours
ny = now.to_timezone("America/New_York")
print(ny.format("YYYY-MM-DD HH:mm:ss"))
print(now.utc_offset(), now.is_utc(), ny.is_dst())
future = now.add(2, "week").start_of("day")
print(future.to_iso())
print(now.get("month")) # 0-based month (Jan=0)
print(now.set("day", 1).to_iso()) # set weekday (Sunday=0)
print(now.days_in_month())
print(now.quarter(), now.iso_weekday())
print(now.day_of_year(), now.week(), now.iso_week())
print(now.iso_week_year(), now.days_in_year(), now.weeks_in_year(), now.iso_weeks_in_year())
print(now.is_today())
print(now.add(30, "minute").from_now()) # in 30 minutes
print(now.calendar())
print(now.format_locale("dddd, D MMMM YYYY HH:mm", "fr"))
print(now.add_duration(bridge_duration.from_minutes(30)).to_iso())
print(now.is_between(now.start_of("day"), now.end_of("day"), "day", "[]"))
print(bridge_time.min(now, future).to_iso(), bridge_time.max(now, future).to_iso())
print(now.clamp(now.subtract(1, "day"), now.add(1, "day")).to_iso())
print(supported_units())
print(supported_locales())
parsed = bridge_time.parse_batch(["2026-02-22T10:15:30Z", "2026-02-23T10:15:30Z"], "UTC")
rendered = bridge_time.format_batch(parsed, "dddd, DD MMM YYYY", "UTC", "es")
print(rendered)
API Highlights
- Core:
parse,format,add,subtract,start_of,end_of,diff - Locale/calendar:
format_locale,calendar,supported_locales - Duration helpers:
bridge_duration,bridge_time.duration(value, unit?),add_duration,subtract_duration - Batch parse/format helpers:
parse_batch,parse_format_batch,format_batch - Custom parse helpers:
parse_format(input, pattern, timezone?),from_array(components, timezone?),to_array() - Timezone helpers:
timezone,utc_offset,is_utc,is_dst,to_timezone - Calendar helpers:
get,set, component getters/setters (year,set_year, etc),days_in_month,is_leap_year,is_valid - Week/day helpers:
day_of_year,set_day_of_year,quarter,set_quarter,iso_weekday,set_iso_weekday,week,week_of_year,set_week,iso_week,set_iso_week,iso_week_year,days_in_year,weeks_in_year,iso_weeks_in_year - Relative-day helpers:
is_today,is_yesterday,is_tomorrow - Relative-time helpers:
from_time,to_time,from_now,to_now - Min/max helpers:
bridge_time.min(a, b),bridge_time.max(a, b),clamp(start, end) - Comparison helpers:
is_before,is_after,is_same,is_same_or_before,is_same_or_after,is_same_or_before_unit,is_same_or_after_unit - Unit/range helpers:
is_before_unit,is_after_unit,is_same_unit,is_between
Uppercase exports (BridgeTime, BridgeDuration) are no longer part of the public Python API.
Build Locally
cd bindings/python/bridgetime
maturin develop
Release files for bridgetime 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bridgetime-0.2.3.tar.gz | 89.5 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| bridgetime-0.2.3-cp38-abi3-win_amd64.whl | CPython 3.8 | abi3 | Windows x86-64 | Details |
| bridgetime-0.2.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| bridgetime-0.2.3-cp38-abi3-macosx_11_0_arm64.whl | CPython 3.8 | abi3 | macOS 11.0+ ARM64 | Details |
| bridgetime-0.2.3-cp38-abi3-macosx_10_12_x86_64.whl | CPython 3.8 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 1.9 MB
Release files / bridgetime-0.2.3.tar.gz
| Download URL | bridgetime-0.2.3.tar.gz |
|---|---|
| Size | 89.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
949a097c522a72a57a9ff7ab2d200e6d0366024b4fca4b1c20e2c57d558d7d42
|
|
BLAKE2b-256 checksum How to use checksums |
21c86107a2f63e07b31abe254595077efac37f3d4b3db1ea0ff89f6044c4fae0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / bridgetime-0.2.3-cp38-abi3-win_amd64.whl
| Download URL | bridgetime-0.2.3-cp38-abi3-win_amd64.whl |
|---|---|
| Size | 383.5 kB |
| Tags | CPython 3.8 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
4e0fcdb8ce243aa7d67ce08ad9f12297a1ffbaa8cd72ba95b85976afcb716fd1
|
|
BLAKE2b-256 checksum How to use checksums |
1ed2905929bba4b3f0433d2f9d7810559a3278a1e069746b7f30d5c8b617a2f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / bridgetime-0.2.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | bridgetime-0.2.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 534.5 kB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
9eac3dbcd55c2f6145ed1c5a69ba6613be5b2a8243b538817f4b0254fe9c588e
|
|
BLAKE2b-256 checksum How to use checksums |
7bf0f51f161fdfd72f4ebabd770de5565ca7b6ef5f08f6c96a1967234112a384
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / bridgetime-0.2.3-cp38-abi3-macosx_11_0_arm64.whl
| Download URL | bridgetime-0.2.3-cp38-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 450.2 kB |
| Tags | CPython 3.8 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
0b50c797c21edcc8bf38613c02a17c2b57c9893d7239b187da5c0f4bc950326b
|
|
BLAKE2b-256 checksum How to use checksums |
de498fa5e0119d67e5677727b955231cb102cef3dbfc19a99358770751e2d500
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / bridgetime-0.2.3-cp38-abi3-macosx_10_12_x86_64.whl
| Download URL | bridgetime-0.2.3-cp38-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 464.5 kB |
| Tags | CPython 3.8 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
c5b6f2014646178986e0afb54f810b08ae47840aa8d1ee76a2b72059555a2cf1
|
|
BLAKE2b-256 checksum How to use checksums |
b7e65056ad0353659ff3edee755d1cd6691b68bf90f370036cacb7b5f64d2e39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|