Skip to main content

Vietnamese lunar calendar conversion (Ho Ngoc Duc algorithm, per calrules)

Project description

Am Lich Viet Nam

Python library for converting between Gregorian (solar) calendar
and Vietnamese lunar calendar.

Goal: simple – accurate – easy to reuse


FEATURES

- Convert Solar -> Lunar (dd/mm/yyyy -> lunar day/month/year with leap month flag)
- Convert Lunar -> Solar
- Leap month support
- Timezone support (parameter: time_zone, default UTC+7 – Vietnam)


INSTALLATION

#TODO Install via pip (after publishing):
pip install amlichvietnam


LOCAL TESTING

pip install -e .
pip install pytest
pytest -q


USAGE EXAMPLE

import datetime as dt
from lunar_vn import solar_to_lunar, lunar_to_solar, LunarDate

# Solar -> Lunar
l = solar_to_lunar((17, 2, 2026)) # Vietnamese Lunar New Year 2026
print(l) # LunarDate(day=1, month=1, year=2026, leap=False)

# Lunar -> Solar
d = lunar_to_solar(LunarDate(1, 1, 2026))
print(d) # 2026-02-17

# Using datetime.date
l2 = solar_to_lunar(dt.date(2024, 2, 10))
print(l2) # LunarDate(day=1, month=1, year=2024, leap=False)


ATTRIBUTION

The Vietnamese lunar calendar algorithm is described by Ho Ngoc Duc
on the website: https://xemamlich.uhm.vn

This library is a Python re-implementation of the published algorithm.
No original source code is copied.


LICENSE

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lunar_vn-1.0.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lunar_vn-1.0.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file lunar_vn-1.0.0.tar.gz.

File metadata

  • Download URL: lunar_vn-1.0.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lunar_vn-1.0.0.tar.gz
Algorithm Hash digest
SHA256 51f799a453c3d668967ccb531aaf5e4b1c562c0ba38205c1d036f906385a0da0
MD5 dd73924b938cb0db57833d11816fdcfc
BLAKE2b-256 73bb6e00f00800f058e7aa64e71118fa1941b61b5c6bf30fd93219f45d1d8981

See more details on using hashes here.

Provenance

The following attestation bundles were made for lunar_vn-1.0.0.tar.gz:

Publisher: publish.yml on junkeythong/amlichvietnam

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lunar_vn-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: lunar_vn-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lunar_vn-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1495fb26076232c82459e09adfa3bd938892e7189dadb887874a15a30c0527ac
MD5 9c60e31668f5c7ca612494cd0bb3ba80
BLAKE2b-256 450ff00a58ec4d6c22e4d07c7012dd082b1a4a458ffef3b026295bf1d7d18851

See more details on using hashes here.

Provenance

The following attestation bundles were made for lunar_vn-1.0.0-py3-none-any.whl:

Publisher: publish.yml on junkeythong/amlichvietnam

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page