A simple Python package to find Chinese New Year and Chinese Zodiac
Project description
Chinese-New-Year-and-Zodiac
Date: Fri 10 February 2023 20:21:38 CET
Author: Nicolas Flandrois
Licence: MIT License - Copyright (c) 2023 - Nicolas Flandrois
DESCRIPTION:
Chinese-New-Year-and-Zodiac package aim to automate finding Chinese New Year's date, and/or find the Chinese Zodiac sign, for a given Year or Date.
This package is set to be multi languages:
- 'en' - English (default)
- 'fr' - French
- 'cn' - Chinese (simplified chinese, mainland china, mandarin) work in progress
Install
pip install ChineseNewYear-Zodiac
How to use it?
exemples:
from CnyZodiac import ChineseNewYearZodiac as cnyz
# Default settings (lang='en')
my_cnyz = cnyz()
# Change Language
en_cnyz = cnyz(lang='en') # English
fr_cnyz = cnyz(lang='fr') # French
cn_cnyz = cnyz(lang='cn') # Simplified Chinese Mandarin (Work In Progress)
# Chinese Zodiac for a given Year
zodiac_2023 = my_cnyz.zodiac(2023)
# output: Rabbit
# Find the Chinese New Year's date for a given year (Integer)
cny_2023 = my_cnyz.chinese_new_year(2023)
# output: datetime.date(2023, 1, 22)
# Given a datetime object find out it's Chinese Zodiac sign
zodiac_date = zodiac_date(datetime.datetime(1998, 7, 15))
# output: Tiger
# Find out what Chinese Zodiac sign is it right now
now_zodiac = my_cnyz.zodiac_now() # e.g. if command launched on 2023-02-10
# outupt: Rabbit
# For a given datetime object, find out in more detailed informations: New Year this year, and current Chinese Zodiac
cnyz_1968 = my_cnyz.chinese_new_year_zodiac_full_details_date(datetime.datetime(1968, 6, 6, 1, 59, 5))
# output:
# {
# 'Chinese New Year': date(1968, 1, 30),
# 'Zodiac': 'Monkey',
# 'date': datetime(1968, 6, 6, 1, 59, 5),
# 'year': 1968
# }
# Get detailed information for current datetime.now() automatically
cnyz_now = my_cnyz.chinese_new_year_zodiac_full_details_now()
# output (if current datetime is 2023-02-10):
# {
# 'Chinese New Year': date(2023, 1, 22),
# 'Zodiac': 'Rabbit',
# 'date': datetime(2023, 2, 10, 1, 59, 5),
# 'year': 2023
# }
# Get detailed information for next (comming) year, based on datetime.now() automatically
cnyz_now = my_cnyz.chinese_new_year_zodiac_full_details_now()
# output (if current datetime is 2023-07-04):
# {
# 'Chinese New Year': date(2024, 2, 10),
# 'Zodiac': 'Dragon',
# 'year': 2024
# }
TODO (Work In Progress, still in development)
- Add Simplified Chinese in multi lang.
- Optimize code AND find a mathematical full proof way to conteract leap months, so this package can work for ANY given year/date (past of future).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for ChineseNewYear_Zodiac-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8bb3bf6ee53de792133a68d3a8847061e7d526254106e01108685fc5ae4797d8 |
|
MD5 | 81925853eac2e1e3da4f0c5a6511b0f2 |
|
BLAKE2b-256 | 30ec99dba5ca8655190a0b5a0dfd0bdfe40ab5cb600df1203d834803dfb0031f |
Close
Hashes for ChineseNewYear_Zodiac-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89f3f04793e284e2ef03ff4fcc01e44698bcb2bee556f43e7bb2773d1a1c3d22 |
|
MD5 | 5d34c17184bfb00d01325903f42fc5a8 |
|
BLAKE2b-256 | 5f08054f54e710b5043ca58204b90c71ea8392b539a9fd56052ece0eac9bffcf |