# FixedCal
[![CI](https://github.com/PyryL/fixedcal/actions/workflows/main.yml/badge.svg)](https://github.com/PyryL/fixedcal/actions)
[![codecov](https://codecov.io/gh/PyryL/fixedcal/branch/main/graph/badge.svg?token=ZMYYLBUPNA)](https://codecov.io/gh/PyryL/fixedcal)
[![GitHub](https://img.shields.io/github/license/PyryL/fixedcal)](LICENSE)
Python package for international fixed calendar dates.
## What is that?
International fixed calendar is an alternative calendar system.
It divides year into 13 even months by adding a month called Sol between June and July.
Each month starts with Sunday and has exactly 28 days or 4 weeks.
An additional _year day_ is added to the end of the year and it does not belong to any of the months and has no weekday.
You can read more about IFC on [Wikipedia](https://en.wikipedia.org/wiki/International_Fixed_Calendar).
## Installation
This package is available via PyPI:
```
pip install fixedcal
```
You can also download the package directly from [releases](https://github.com/PyryL/fixedcal/releases).
## Usage
### Date initialization
```python3
from fixedcal import FixedDate
# Date of today
fixed_date = FixedDate.today()
# From native datetime
import datetime
february_seventh = datetime.date(2022, 2, 7)
fixed_date = FixedDate(february_seventh)
# From day's ordinal in year
fixed_date = FixedDate(day_of_year=107, year=2022)
```
### Date's properties
```python3
from fixedcal import FixedDate
import datetime
fixed_date = FixedDate(datetime.date(2022, 8, 12))
fixed_date.date # datetime.date(2022, 8, 12)
fixed_date.day_of_year # 224
fixed_date.day_of_month # 28
fixed_date.month # 8
fixed_date.year # 2022
fixed_date.is_year_day # False
fixed_date.is_leap_day # False
fixed_date.is_leap_year # False
fixed_date.week_of_month # 4
fixed_date.weekday # 7
fixed_date.week_of_year # 32
fixed_date.year_quarter # 3
```
### Date's operations
```python3
from fixedcal import FixedDate
from datetime import date, timedelta
fixed_date = FixedDate(date(2022, 12, 6))
jan_first = FixedDate(date(2023, 1, 1))
str(fixed_date) # 2022-13-04
new_fixed = fixed_date + timedelta(3) # FixedDate 3 days ahead
new_fixed = fixed_date - timedelta(2) # FixedDate 2 days before
new_fixed = jan_first - fixed_date # timedelta between dates
fixed_date == fixed_date # True
fixed_date != jan_first # True
jan_first < fixed_date # False
```
### Year day
Year day is the day after the last of December and before the first of January.
For that date, `FixedDate` gives the following property values.
* `day_of_year` = 365 (366 on leap years)
* `day_of_month` = 29
* `month` = 13
* `year` is obviously the ending year
* `is_year_day` = True
* `week_of_month` = 4
* `weekday` = None
* `week_of_year` = 52
* `year_quarter` = 4
### Leap day
Leap day occurres on the same years as in Gregorian calendar. However, the placement of that day is different: after the last day of June and before the first day of Sol (17th June in Gregorian). The following properties are given by `FixedDate` for leap day:
* `day_of_year` = 169
* `day_of_month` = 29
* `month` = 6
* `is_leap_day` = True
* `is_leap_year` = True
* `week_of_month` = 4
* `weekday` = None
* `week_of_year` = 24
* `year_quarter` = 2
## Contributing
Yes, you can contribute in the development of this package. If you find a bug or have a feature request, please file an [issue](https://github.com/PyryL/fixedcal/issues/new). You can also modify the code yourself and create a pull request.
You need [Poetry](https://python-poetry.org/) to manage the development environment. After downloading the source code of this package, run `poetry install` to install development dependencies and to set up a compatible Python environment.
Please check the following topics before creating a pull request:
* Your changes should not create new Pylint errors.
* There should be proper unit tests included in the pull request. This consists of high branch coverage (>90%) and quality of the tests. Working with dates has a lot of corner cases and tests are the best way to avoid bugs.
* The structure of the project should remain healthy: split the code between modules and packages.
Raw data
{
"_id": null,
"home_page": "https://github.com/PyryL/fixedcal",
"name": "fixedcal",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10,<4.0",
"maintainer_email": "",
"keywords": "International Fixed Calendar,IFC,date,datetime",
"author": "Pyry Lahtinen",
"author_email": "pyry@pyry.info",
"download_url": "https://files.pythonhosted.org/packages/4c/16/1139e59794b62e2fa2a0f2892a29d484616359d601f8ec618d1a18a65670/fixedcal-1.0.0.tar.gz",
"platform": null,
"description": "# FixedCal\n\n[![CI](https://github.com/PyryL/fixedcal/actions/workflows/main.yml/badge.svg)](https://github.com/PyryL/fixedcal/actions)\n[![codecov](https://codecov.io/gh/PyryL/fixedcal/branch/main/graph/badge.svg?token=ZMYYLBUPNA)](https://codecov.io/gh/PyryL/fixedcal)\n[![GitHub](https://img.shields.io/github/license/PyryL/fixedcal)](LICENSE)\n\nPython package for international fixed calendar dates.\n\n## What is that?\n\nInternational fixed calendar is an alternative calendar system.\nIt divides year into 13 even months by adding a month called Sol between June and July.\nEach month starts with Sunday and has exactly 28 days or 4 weeks.\nAn additional _year day_ is added to the end of the year and it does not belong to any of the months and has no weekday.\nYou can read more about IFC on [Wikipedia](https://en.wikipedia.org/wiki/International_Fixed_Calendar).\n\n## Installation\n\nThis package is available via PyPI:\n\n```\npip install fixedcal\n```\n\nYou can also download the package directly from [releases](https://github.com/PyryL/fixedcal/releases).\n\n## Usage\n\n### Date initialization\n\n```python3\nfrom fixedcal import FixedDate\n\n# Date of today\nfixed_date = FixedDate.today()\n\n# From native datetime\nimport datetime\nfebruary_seventh = datetime.date(2022, 2, 7)\nfixed_date = FixedDate(february_seventh)\n\n# From day's ordinal in year\nfixed_date = FixedDate(day_of_year=107, year=2022)\n```\n\n### Date's properties\n\n```python3\nfrom fixedcal import FixedDate\nimport datetime\nfixed_date = FixedDate(datetime.date(2022, 8, 12))\n\nfixed_date.date # datetime.date(2022, 8, 12)\nfixed_date.day_of_year # 224\nfixed_date.day_of_month # 28\nfixed_date.month # 8\nfixed_date.year # 2022\nfixed_date.is_year_day # False\nfixed_date.is_leap_day # False\nfixed_date.is_leap_year # False\nfixed_date.week_of_month # 4\nfixed_date.weekday # 7\nfixed_date.week_of_year # 32\nfixed_date.year_quarter # 3\n```\n\n### Date's operations\n\n```python3\nfrom fixedcal import FixedDate\nfrom datetime import date, timedelta\n\nfixed_date = FixedDate(date(2022, 12, 6))\njan_first = FixedDate(date(2023, 1, 1))\n\nstr(fixed_date) # 2022-13-04\n\nnew_fixed = fixed_date + timedelta(3) # FixedDate 3 days ahead\nnew_fixed = fixed_date - timedelta(2) # FixedDate 2 days before\nnew_fixed = jan_first - fixed_date # timedelta between dates\n\nfixed_date == fixed_date # True\nfixed_date != jan_first\t # True\njan_first < fixed_date # False\n```\n\n### Year day\n\nYear day is the day after the last of December and before the first of January.\nFor that date, `FixedDate` gives the following property values.\n\n* `day_of_year` = 365 (366 on leap years)\n* `day_of_month` = 29\n* `month` = 13\n* `year` is obviously the ending year\n* `is_year_day` = True\n* `week_of_month` = 4\n* `weekday` = None\n* `week_of_year` = 52\n* `year_quarter` = 4\n\n### Leap day\n\nLeap day occurres on the same years as in Gregorian calendar. However, the placement of that day is different: after the last day of June and before the first day of Sol (17th June in Gregorian). The following properties are given by `FixedDate` for leap day:\n\n* `day_of_year` = 169\n* `day_of_month` = 29\n* `month` = 6\n* `is_leap_day` = True\n* `is_leap_year` = True\n* `week_of_month` = 4\n* `weekday` = None\n* `week_of_year` = 24\n* `year_quarter` = 2\n\n## Contributing\n\nYes, you can contribute in the development of this package. If you find a bug or have a feature request, please file an [issue](https://github.com/PyryL/fixedcal/issues/new). You can also modify the code yourself and create a pull request.\n\nYou need [Poetry](https://python-poetry.org/) to manage the development environment. After downloading the source code of this package, run `poetry install` to install development dependencies and to set up a compatible Python environment.\n\nPlease check the following topics before creating a pull request:\n\n* Your changes should not create new Pylint errors.\n* There should be proper unit tests included in the pull request. This consists of high branch coverage (>90%) and quality of the tests. Working with dates has a lot of corner cases and tests are the best way to avoid bugs.\n* The structure of the project should remain healthy: split the code between modules and packages.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Fixed calendar package",
"version": "1.0.0",
"split_keywords": [
"international fixed calendar",
"ifc",
"date",
"datetime"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "117a039d99ec90ccc9cae7a0c110ddc0",
"sha256": "3b3305a53670b251b26ec1271ae28c487fc10ad4df8031efdf44b3f655854509"
},
"downloads": -1,
"filename": "fixedcal-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "117a039d99ec90ccc9cae7a0c110ddc0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10,<4.0",
"size": 6420,
"upload_time": "2022-12-18T14:26:03",
"upload_time_iso_8601": "2022-12-18T14:26:03.465625Z",
"url": "https://files.pythonhosted.org/packages/8e/03/ef789d1915ca9a43dd6759d8a00b908da82e4f64a9b917190a7f4eca41fd/fixedcal-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "90b940ccc08bd6b5afa7de8efbd49775",
"sha256": "abef4e9f3cc0d1f45cca3e24e3ec1461cb6ee11a5dfa829824df1b911cb0f7fa"
},
"downloads": -1,
"filename": "fixedcal-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "90b940ccc08bd6b5afa7de8efbd49775",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10,<4.0",
"size": 6136,
"upload_time": "2022-12-18T14:26:05",
"upload_time_iso_8601": "2022-12-18T14:26:05.212340Z",
"url": "https://files.pythonhosted.org/packages/4c/16/1139e59794b62e2fa2a0f2892a29d484616359d601f8ec618d1a18a65670/fixedcal-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-18 14:26:05",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "PyryL",
"github_project": "fixedcal",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "fixedcal"
}