The French Republican calendar and decimal time in Python in Chinese and French
Project description
Repcalchn
本项目提供公历日期与时间向法国共和历转换的功能,支持汉语(简体中文)和法语。A script that converts date and time to the French Republican systems used by the French Republic, supports Simplified Chinese and French.
This repo borrows heavily from dekadans/repcal.
A script that converts date and time to the systems used by the French Republic, the calendar from 1793 to 1805 and decimal time for about a year between 1794 and 1795. More information can be found on Wikipedia, Wikipedia Chinese
It uses the Romme method of calculating leap years, as in keeping the ones used by the French Republic and using the Gregorian rules for the years after the calendar was abolished.
In comparison with dekadans/repcal, this repo offers flag and APIs that supports Chinese.
Installation
$ pip install repcalchn
Usage
The current local time is used by default.
$ repcalchn
5:60:56, 法国共和历 231年 菓月 18 鼠李日 星期八
Or, for the full Republican experience, it can default to Paris Mean Time (6.49 decimal minutes ahead of GMT).
$ repcalchn --paris-mean
2:33:91, 法国共和历 231年 菓月 18 鼠李日 星期八
If you want see it in French, just add --fr
$ repcalchn --fr
5:62:1, octidi 18 fructidor an CCXXXI
It also accepts date, time and format as arguments.
$ repcalchn '1969-07-20 20:17:40'
8:45:60, 法国共和历 177年 牧月 1 紫花苜蓿日 星期一
$ repcalchn '1969-07-20'
法国共和历 177年 牧月 1 紫花苜蓿日 星期一
$ repcalchn '20:17:40'
8:45:60
$ repcalchn '1969-07-20' --format '{%d} {%B}'
1 thermidor
$ repcalchn '1969-07-20' --format '{%y}年 {%b} {%d}'
177年 牧月 1
As a Python package
from repcalchn import RepublicanDate, DecimalTime
from datetime import datetime
n = datetime.now()
rd = RepublicanDate.from_gregorian(n.date())
rd.set_chinese_formatting()
dt = DecimalTime.from_standard_time(n.time())
print(rd) # 法国共和历 231年 菓月 18 鼠李日 星期八
print(dt) # 5:66:4
RepublicanDate API
Value | Instance method | Format placeholder | Example | Note |
---|---|---|---|---|
Year (arabic) | get_year_arabic() | %y | 219 | |
Year (roman) | get_year_roman() | %Y | CCXXIX | |
Month | get_month() | %B | vendémiaire | Method returnsNone and placeholder returns '' if is_sansculottides() is True . |
Month (Chinese) | get_month_chn() | %b | 获月 | Method returnsNone and placeholder returns '' if is_sansculottides() is True . |
Week (décade) | get_week_number() | %W | 3 | |
Day in month | get_day() | %d | 28 | |
Day in week | get_weekday() | %A | octidi | Method and placeholder returns french sansculottides name ifis_sansculottides() isTrue . |
Day in week (Chinese) | get_weekday_chn() | %a | 星期八 | Method and placeholder returns Unique Day name ifis_sansculottides() isTrue . |
Unique Day name (Chinese) | get_unique_chn() | %x | 紫花苜蓿日 | Every date in French Republican Calendar has an unique name. |
Full Unique Day name (Chinese) | get_full_unique_chn() | %X | 牧月 紫花苜蓿日 | Month and unique day name in chinese. No month ifis_sansculottides() is True . |
Is complementary | is_sansculottides() | -- | false | Check if it is a sansculottides day, which is not included in any month. |
DecimalTime API
Value | Property | Format placeholder | Example |
---|---|---|---|
Hour | hour | %H | 8 |
Minute | minute | %M | 1 |
Second | second | %S | 65 |
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
File details
Details for the file repcalchn-1.0.0.tar.gz
.
File metadata
- Download URL: repcalchn-1.0.0.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
6e74c7d10f3139141c9065c75b260133ff59e8cf507171ef3fb74828af1e3f29
|
|
MD5 |
68cfde1ef89527c1d52f9c3a4e3eed49
|
|
BLAKE2b-256 |
938934c44efab709639da62e2a5a86796e5a454d5cd573e233c13f885927ecf4
|