Skip to main content

Tanggalan

Pustaka tanggalan menyediakan binding Python untuk perhitungan kalender Jawa (ditulis dengan Rust).

Instalasi

Instal paket menggunakan pip:

pip install tanggalan

Penggunaan Dasar

Kelas utama adalah Tanggalan.

from tanggalan import Tanggalan
from datetime import datetime

# 1. Tanggal Saat Ini
now = Tanggalan()
print(f"Sekarang: {now}")
# Output: Sekarang: Jemuah Legi, 9 Pasa 1876 Ja, Lingsir Wengi (contoh)

# 2. Tanggal Tertentu (17 Agustus 1945)
# Gunakan datetime standar Python
merdeka = datetime(1945, 8, 17, 10, 0, 0)
jd = Tanggalan(merdeka)

# 3. Akses Properti
print(f"Dina: {jd.dina}")       # Jemuah
print(f"Pasaran: {jd.pasaran}") # Legi
print(f"Wuku: {jd.wuku}")       # Manahil
print(f"Neptu: {jd.neptu}")     # 11 (Jemuah 6 + Legi 5)

# Output default (__str__)
print(jd) 
# Output: Jemuah Legi, 9 Pasa 1876 Ja, Lingsir Wengi

Parsing String

Anda dapat membuat objek Tanggalan dari string tanggal Jawa.

from tanggalan import Tanggalan

input_str = "28 Jumadilawal 1955"
fmt = "d M yyyy"

try:
    jd = Tanggalan.from_string(input_str, fmt)
    print(f"Berhasil parse: {jd}")
    print(f"Weton: {jd.dina} {jd.pasaran}")
except ValueError as e:
    print(f"Error: {e}")

Formatting

Gunakan method format_string untuk memformat output sesuai kebutuhan.

pattern = "Dina: D, Pasaran: P, Mongso: MS"
print(jd.format_string(pattern))
# Output: Dina: Jemuah, Pasaran: Legi, Mongso: Karo

Token Format

Berikut adalah daftar token yang dapat digunakan dalam string format:

Token Deskripsi Contoh
D Nama Hari (Dina) Setu
P Pasaran Pahing
d Tanggal (1-30) 26
dd Tanggal (01-30) 26
M Nama Bulan (Wulan) Ruwah
m Nomor Bulan (1-12) 8
mm Nomor Bulan (01-12) 08
yyyy Tahun (Jawa) 1959
T Nama Tahun Windu Alip
W Wuku Wukir
N Neptu 18
MS Mongso Kasa
WK Wektu Surup
HH Jam 14
MM Menit 30
SS Detik 00

Fitur Lanjutan

Mencari Weton Berikutnya (weton_sabanjure)

Mencari tanggal terdekat di masa depan yang memiliki kombinasi Dina dan Pasaran tertentu.

try:
    next_weton = jd.weton_sabanjure("Senen Legi")
    print(f"Senen Legi berikutnya: {next_weton}")
except ValueError as e:
    print(f"Error: {e}")

Cek Tahun Kabisat (is_kabisat)

if jd.is_kabisat():
    print(f"Tahun {jd.year} adalah tahun kabisat (355 hari)")
else:
    print(f"Tahun {jd.year} adalah tahun basit (354 hari)")

Referensi API

Class Tanggalan

Static Methods

  • from_string(input: str, format: str) -> Tanggalan: Membuat instance dari string tanggal Jawa.

Properties (String)

Properti Tipe Deskripsi
dina str Nama hari (misal: "Senen")
pasaran str Nama pasaran (misal: "Wage")
wulan str Nama bulan (misal: "Sura")
taun str Nama tahun (misal: "Ehe")
wuku str Nama wuku
mongso str Nama mongso
wektu str Waktu hari (misal: "Surup")

Methods

  • get_date() -> int: Tanggal Jawa (1-30).
  • get_day() -> int: Indeks hari (0=Minggu, 6=Setu).
  • get_month() -> int: Indeks bulan (0=Sura).
  • get_full_year() -> int: Tahun Jawa.
  • get_pasaran() -> int: Indeks pasaran (0=Legi).
  • get_neptu() -> int: Total nilai neptu.
  • get_wuku() -> int: Indeks wuku (0=Sinta).
  • get_mongso() -> int: Indeks mongso (0=Kasa).
  • get_wektu() -> str: Waktu hari (misal: "Surup").
  • get_gregorian_date() -> datetime: Mengembalikan objek datetime native.
  • is_kabisat() -> bool: Mengecek apakah tahun Jawa saat ini adalah tahun kabisat (355 hari).
  • weton_sabanjure(weton: str) -> Tanggalan: Mencari tanggal terjadinya weton tertentu di masa depan.
  • format_string(pattern: str) -> str: Memformat tanggal menjadi string menggunakan token.
  • __str__() -> str: Representasi string default.

Referensi

Metadata

Release files for tanggalan 1.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 tanggalan 1.1.2
File Size Uploaded Provenance Actions
tanggalan-1.1.2.tar.gz 9.1 kB Without provenance Details for tanggalan-1.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tanggalan 1.1.2
File Interpreter ABI Platform Actions
tanggalan-1.1.2-py3-none-any.whl Python 3 none any Details for tanggalan-1.1.2-py3-none-any.whl

Total release size: 17.6 kB

Release files / tanggalan-1.1.2.tar.gz

Download URL tanggalan-1.1.2.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
dc15b64b502f5be819ecfe0b6c2210e6e9f3dcc0bbfd1cd9a09e6b6f08c5d1ce
BLAKE2b-256 checksum
How to use checksums
9a98e2cb0d2d536fbcb596a0b086bbe0cb9a67c164e0866c826f9d202b43b6b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / tanggalan-1.1.2-py3-none-any.whl

Download URL tanggalan-1.1.2-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ce4d74dacf90de8a785f9a4a1b7982c866fd21ea4175759c20d9e3c8dd03227e
BLAKE2b-256 checksum
How to use checksums
7733d99b1fbe6fb1b8252b0d611fba43c1127cdb8976c3c4cfa6f970e5d1da62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Security for tanggalan 1.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.2 This release

2 release files No provenance

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