Skip to main content

A Chinese Calendar Library in Pure Python

Project description

Chinese Calendar: http://en.wikipedia.org/wiki/Chinese_calendar

Usage

>>> LunarDate.fromSolarDate(1976, 10, 1)
LunarDate(1976, 8, 8, 1)
>>> LunarDate(1976, 8, 8, 1).toSolarDate()
datetime.date(1976, 10, 1)
>>> LunarDate(1976, 8, 8, 1).year
1976
>>> LunarDate(1976, 8, 8, 1).month
8
>>> LunarDate(1976, 8, 8, 1).day
8
>>> LunarDate(1976, 8, 8, 1).isLeapMonth
True
>>> today = LunarDate.today()
>>> type(today).__name__
'LunarDate'
>>> # support '+' and '-' between datetime.date and datetime.timedelta
>>> ld = LunarDate(1976,8,8)
>>> sd = datetime.date(2008,1,1)
>>> td = datetime.timedelta(days=10)
>>> ld-ld
datetime.timedelta(0)
>>> (ld-sd).days
-11444
>>> ld-td
LunarDate(1976, 7, 27, 0)
>>> (sd-ld).days
11444
>>> ld+td
LunarDate(1976, 8, 18, 0)
>>> td+ld
LunarDate(1976, 8, 18, 0)
>>> ld2 = LunarDate.today()
>>> ld < ld2
True
>>> ld <= ld2
True
>>> ld > ld2
False
>>> ld >= ld2
False
>>> ld == ld2
False
>>> ld != ld2
True
>>> ld == ld
True
>>> LunarDate.today() == LunarDate.today()
True
>>> before_leap_month = LunarDate.fromSolarDate(2088, 5, 17)
>>> before_leap_month.year
2088
>>> before_leap_month.month
4
>>> before_leap_month.day
27
>>> before_leap_month.isLeapMonth
False
>>> leap_month = LunarDate.fromSolarDate(2088, 6, 17)
>>> leap_month.year
2088
>>> leap_month.month
4
>>> leap_month.day
28
>>> leap_month.isLeapMonth
True
>>> after_leap_month = LunarDate.fromSolarDate(2088, 7, 17)
>>> after_leap_month.year
2088
>>> after_leap_month.month
5
>>> after_leap_month.day
29
>>> after_leap_month.isLeapMonth
False

Limits

this library can only deal with year from 1900 to 2099 (in chinese calendar).

See also

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

lunardate-0.2.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distributions

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

lunardate-0.2.0-py3.7.egg (10.2 kB view details)

Uploaded Egg

lunardate-0.2.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

lunardate-0.2.0-py2.7.egg (10.1 kB view details)

Uploaded Egg

lunardate-0.2.0-py2-none-any.whl (5.6 kB view details)

Uploaded Python 2

File details

Details for the file lunardate-0.2.0.tar.gz.

File metadata

  • Download URL: lunardate-0.2.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for lunardate-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6c9c96d9f01522a10ab35df1a9b48707ae64a086f13fd34498b43f465918cc6f
MD5 ea6a1558ead36a2c0e51d6715dc784c0
BLAKE2b-256 d7ce571488ce9f7c79f8e1e0e4269b72e32c990547d41c5c77ee81dc069795db

See more details on using hashes here.

File details

Details for the file lunardate-0.2.0-py3.7.egg.

File metadata

  • Download URL: lunardate-0.2.0-py3.7.egg
  • Upload date:
  • Size: 10.2 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.7

File hashes

Hashes for lunardate-0.2.0-py3.7.egg
Algorithm Hash digest
SHA256 dd7d7c7a61dbb843662eb8b04da2f0c8bb1e9e2c1dd8acced6ebcb21151eb19c
MD5 3a6da849529994fa551203e96b13f06b
BLAKE2b-256 69cbe4a311a849c25d74df2198061cf161f6d5125523fd685e55a9231fca6053

See more details on using hashes here.

File details

Details for the file lunardate-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: lunardate-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for lunardate-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5619d625809ebcaa673c4e321cd1ea82e649e9bb47e42e6479fe15bbc2b5bffe
MD5 bd22afe3cda41f519e235b1d301a2eda
BLAKE2b-256 4e7e377a3cbba646ec0cf79433ef858881d809a3b87eb887b0901cb83c66a758

See more details on using hashes here.

File details

Details for the file lunardate-0.2.0-py2.7.egg.

File metadata

  • Download URL: lunardate-0.2.0-py2.7.egg
  • Upload date:
  • Size: 10.1 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/2.7

File hashes

Hashes for lunardate-0.2.0-py2.7.egg
Algorithm Hash digest
SHA256 f0bb5938d7c7f363a26f599a3c27b7f5560edd8b689ef3c5865ec401dfc7ed88
MD5 12135c6986c70b0de80e250e94010b5e
BLAKE2b-256 0a3d4e044d104a59dbde228bec1a75243ff121d4388e2f0606c11248572f6a9c

See more details on using hashes here.

File details

Details for the file lunardate-0.2.0-py2-none-any.whl.

File metadata

  • Download URL: lunardate-0.2.0-py2-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for lunardate-0.2.0-py2-none-any.whl
Algorithm Hash digest
SHA256 838e84b95d185a12f8bd0c5bdd74864be52d55436bed56927fdc91f4d21ad6b6
MD5 cc989e4bfc360f467a0621c43a0bbf25
BLAKE2b-256 c6d8f382ddbf8af5026d22815cb3b7e706240c9aa056a1f1815a51754cfab365

See more details on using hashes here.

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