dateutilx 0.0.1__tar.gz → 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dateutilx-0.1.1/.base_project/LICENSE +54 -0
- dateutilx-0.1.1/.gitignore +33 -0
- dateutilx-0.1.1/LICENSE +58 -0
- dateutilx-0.1.1/PKG-INFO +208 -0
- dateutilx-0.1.1/README.md +123 -0
- dateutilx-0.1.1/pyproject.toml +63 -0
- dateutilx-0.1.1/src/dateutil/__init__.py +5 -0
- dateutilx-0.1.1/src/dateutilx/__init__.py +21 -0
- dateutilx-0.1.1/src/dateutilx/easter.py +93 -0
- dateutilx-0.1.1/src/dateutilx/errors.py +25 -0
- dateutilx-0.1.1/src/dateutilx/helper/__init__.py +1 -0
- dateutilx-0.1.1/src/dateutilx/helper/constants.py +67 -0
- dateutilx-0.1.1/src/dateutilx/info.py +9 -0
- dateutilx-0.1.1/src/dateutilx/parser/__init__.py +53 -0
- dateutilx-0.1.1/src/dateutilx/parser/_parser.py +1552 -0
- dateutilx-0.1.1/src/dateutilx/parser/isoparser.py +411 -0
- dateutilx-0.1.1/src/dateutilx/parser/utils.py +78 -0
- dateutilx-0.1.1/src/dateutilx/relativedelta.py +604 -0
- dateutilx-0.1.1/src/dateutilx/rrule.py +1647 -0
- dateutilx-0.1.1/src/dateutilx/tz/__init__.py +36 -0
- dateutilx-0.1.1/src/dateutilx/tz/_common.py +278 -0
- dateutilx-0.1.1/src/dateutilx/tz/_factories.py +67 -0
- dateutilx-0.1.1/src/dateutilx/tz/_win.py +359 -0
- dateutilx-0.1.1/src/dateutilx/tz/tz.py +1697 -0
- dateutilx-0.1.1/src/dateutilx/tz/win.py +15 -0
- dateutilx-0.1.1/src/dateutilx/tzwin.py +4 -0
- dateutilx-0.1.1/src/dateutilx/utils.py +65 -0
- dateutilx-0.1.1/src/dateutilx/weekday.py +42 -0
- dateutilx-0.0.1/LICENSE +0 -21
- dateutilx-0.0.1/PKG-INFO +0 -61
- dateutilx-0.0.1/README.md +0 -35
- dateutilx-0.0.1/dateutilx.egg-info/PKG-INFO +0 -61
- dateutilx-0.0.1/dateutilx.egg-info/SOURCES.txt +0 -9
- dateutilx-0.0.1/dateutilx.egg-info/dependency_links.txt +0 -1
- dateutilx-0.0.1/dateutilx.egg-info/requires.txt +0 -5
- dateutilx-0.0.1/dateutilx.egg-info/top_level.txt +0 -1
- dateutilx-0.0.1/pyproject.toml +0 -42
- dateutilx-0.0.1/setup.cfg +0 -4
- dateutilx-0.0.1/src/__init__.py +0 -5
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
Copyright 2017- Paul Ganssle <paul@ganssle.io>
|
|
2
|
+
Copyright 2017- dateutil contributors (see AUTHORS file)
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
|
|
16
|
+
The above license applies to all contributions after 2017-12-01, as well as
|
|
17
|
+
all contributions that have been re-licensed (see AUTHORS file for the list of
|
|
18
|
+
contributors who have re-licensed their code).
|
|
19
|
+
--------------------------------------------------------------------------------
|
|
20
|
+
dateutil - Extensions to the standard Python datetime module.
|
|
21
|
+
|
|
22
|
+
Copyright (c) 2003-2011 - Gustavo Niemeyer <gustavo@niemeyer.net>
|
|
23
|
+
Copyright (c) 2012-2014 - Tomi Pieviläinen <tomi.pievilainen@iki.fi>
|
|
24
|
+
Copyright (c) 2014-2016 - Yaron de Leeuw <me@jarondl.net>
|
|
25
|
+
Copyright (c) 2015- - Paul Ganssle <paul@ganssle.io>
|
|
26
|
+
Copyright (c) 2015- - dateutil contributors (see AUTHORS file)
|
|
27
|
+
|
|
28
|
+
All rights reserved.
|
|
29
|
+
|
|
30
|
+
Redistribution and use in source and binary forms, with or without
|
|
31
|
+
modification, are permitted provided that the following conditions are met:
|
|
32
|
+
|
|
33
|
+
* Redistributions of source code must retain the above copyright notice,
|
|
34
|
+
this list of conditions and the following disclaimer.
|
|
35
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
36
|
+
this list of conditions and the following disclaimer in the documentation
|
|
37
|
+
and/or other materials provided with the distribution.
|
|
38
|
+
* Neither the name of the copyright holder nor the names of its
|
|
39
|
+
contributors may be used to endorse or promote products derived from
|
|
40
|
+
this software without specific prior written permission.
|
|
41
|
+
|
|
42
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
43
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
44
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
45
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
46
|
+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
47
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
48
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
49
|
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
50
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
51
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
52
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
53
|
+
|
|
54
|
+
The above BSD License Applies to all code, even that also covered by Apache 2.0.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
# Build detritus
|
|
7
|
+
build/
|
|
8
|
+
dist/
|
|
9
|
+
.eggs
|
|
10
|
+
*.egg-info/
|
|
11
|
+
|
|
12
|
+
# Test detritus
|
|
13
|
+
.tox/
|
|
14
|
+
.pytest_cache/
|
|
15
|
+
venv/
|
|
16
|
+
.venv/
|
|
17
|
+
.hypothesis/
|
|
18
|
+
.coverage
|
|
19
|
+
|
|
20
|
+
# Autogenerated version information
|
|
21
|
+
src/dateutilx/_version.py
|
|
22
|
+
|
|
23
|
+
# Sphinx documentation
|
|
24
|
+
docs/_build/
|
|
25
|
+
docs/docs_venv
|
|
26
|
+
|
|
27
|
+
# Timezone information
|
|
28
|
+
tzdata*.tar.gz
|
|
29
|
+
|
|
30
|
+
.idea
|
|
31
|
+
.cache
|
|
32
|
+
.mypy_cache
|
|
33
|
+
yuhi*
|
dateutilx-0.1.1/LICENSE
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
Copyright 2017- Paul Ganssle <paul@ganssle.io>
|
|
2
|
+
Copyright 2017- dateutil contributors (see AUTHORS file)
|
|
3
|
+
Copyright 2026- Rishabh B
|
|
4
|
+
Copyright 2026- dateutilx contributors (see AUTHORS file)
|
|
5
|
+
|
|
6
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
you may not use this file except in compliance with the License.
|
|
8
|
+
You may obtain a copy of the License at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
See the License for the specific language governing permissions and
|
|
16
|
+
limitations under the License.
|
|
17
|
+
|
|
18
|
+
The above license applies to all contributions after 2017-12-01, as well as
|
|
19
|
+
all contributions that have been re-licensed (see AUTHORS file for the list of
|
|
20
|
+
contributors who have re-licensed their code).
|
|
21
|
+
--------------------------------------------------------------------------------
|
|
22
|
+
dateutilx - Extensions to the standard Python datetime module.
|
|
23
|
+
|
|
24
|
+
Copyright (c) 2003-2011 - Gustavo Niemeyer <gustavo@niemeyer.net>
|
|
25
|
+
Copyright (c) 2012-2014 - Tomi Pieviläinen <tomi.pievilainen@iki.fi>
|
|
26
|
+
Copyright (c) 2014-2016 - Yaron de Leeuw <me@jarondl.net>
|
|
27
|
+
Copyright (c) 2015-2026 - Paul Ganssle <paul@ganssle.io>
|
|
28
|
+
Copyright (c) 2015-2026 - dateutil contributors (see AUTHORS file)
|
|
29
|
+
Copyright (c) 2026- - Rishabh B <>
|
|
30
|
+
Copyright (c) 2026- - dateutilx contributors (see AUTHORS file)
|
|
31
|
+
|
|
32
|
+
All rights reserved.
|
|
33
|
+
|
|
34
|
+
Redistribution and use in source and binary forms, with or without
|
|
35
|
+
modification, are permitted provided that the following conditions are met:
|
|
36
|
+
|
|
37
|
+
* Redistributions of source code must retain the above copyright notice,
|
|
38
|
+
this list of conditions and the following disclaimer.
|
|
39
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
40
|
+
this list of conditions and the following disclaimer in the documentation
|
|
41
|
+
and/or other materials provided with the distribution.
|
|
42
|
+
* Neither the name of the copyright holder nor the names of its
|
|
43
|
+
contributors may be used to endorse or promote products derived from
|
|
44
|
+
this software without specific prior written permission.
|
|
45
|
+
|
|
46
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
47
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
48
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
49
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
50
|
+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
51
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
52
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
53
|
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
54
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
55
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
56
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
57
|
+
|
|
58
|
+
The above BSD License Applies to all code, even that also covered by Apache 2.0.
|
dateutilx-0.1.1/PKG-INFO
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dateutilx
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Modern extension to the standard Python datetime module
|
|
5
|
+
Project-URL: Homepage, https://github.com/rsb-23/dateutilx
|
|
6
|
+
Project-URL: Documentation, https://dateutil.readthedocs.io/en/stable/
|
|
7
|
+
Project-URL: Source, https://github.com/rsb-23/dateutilx
|
|
8
|
+
Author: Rishabh B
|
|
9
|
+
License: Copyright 2017- Paul Ganssle <paul@ganssle.io>
|
|
10
|
+
Copyright 2017- dateutil contributors (see AUTHORS file)
|
|
11
|
+
Copyright 2026- Rishabh B
|
|
12
|
+
Copyright 2026- dateutilx contributors (see AUTHORS file)
|
|
13
|
+
|
|
14
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
15
|
+
you may not use this file except in compliance with the License.
|
|
16
|
+
You may obtain a copy of the License at
|
|
17
|
+
|
|
18
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
19
|
+
|
|
20
|
+
Unless required by applicable law or agreed to in writing, software
|
|
21
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
22
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
23
|
+
See the License for the specific language governing permissions and
|
|
24
|
+
limitations under the License.
|
|
25
|
+
|
|
26
|
+
The above license applies to all contributions after 2017-12-01, as well as
|
|
27
|
+
all contributions that have been re-licensed (see AUTHORS file for the list of
|
|
28
|
+
contributors who have re-licensed their code).
|
|
29
|
+
--------------------------------------------------------------------------------
|
|
30
|
+
dateutilx - Extensions to the standard Python datetime module.
|
|
31
|
+
|
|
32
|
+
Copyright (c) 2003-2011 - Gustavo Niemeyer <gustavo@niemeyer.net>
|
|
33
|
+
Copyright (c) 2012-2014 - Tomi Pieviläinen <tomi.pievilainen@iki.fi>
|
|
34
|
+
Copyright (c) 2014-2016 - Yaron de Leeuw <me@jarondl.net>
|
|
35
|
+
Copyright (c) 2015-2026 - Paul Ganssle <paul@ganssle.io>
|
|
36
|
+
Copyright (c) 2015-2026 - dateutil contributors (see AUTHORS file)
|
|
37
|
+
Copyright (c) 2026- - Rishabh B <>
|
|
38
|
+
Copyright (c) 2026- - dateutilx contributors (see AUTHORS file)
|
|
39
|
+
|
|
40
|
+
All rights reserved.
|
|
41
|
+
|
|
42
|
+
Redistribution and use in source and binary forms, with or without
|
|
43
|
+
modification, are permitted provided that the following conditions are met:
|
|
44
|
+
|
|
45
|
+
* Redistributions of source code must retain the above copyright notice,
|
|
46
|
+
this list of conditions and the following disclaimer.
|
|
47
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
48
|
+
this list of conditions and the following disclaimer in the documentation
|
|
49
|
+
and/or other materials provided with the distribution.
|
|
50
|
+
* Neither the name of the copyright holder nor the names of its
|
|
51
|
+
contributors may be used to endorse or promote products derived from
|
|
52
|
+
this software without specific prior written permission.
|
|
53
|
+
|
|
54
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
55
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
56
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
57
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
58
|
+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
59
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
60
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
61
|
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
62
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
63
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
64
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
65
|
+
|
|
66
|
+
The above BSD License Applies to all code, even that also covered by Apache 2.0.
|
|
67
|
+
License-File: LICENSE
|
|
68
|
+
Keywords: date,datetime,dateutil,time,timezone
|
|
69
|
+
Classifier: Development Status :: 4 - Beta
|
|
70
|
+
Classifier: Intended Audience :: Developers
|
|
71
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
72
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
73
|
+
Classifier: Programming Language :: Python
|
|
74
|
+
Classifier: Programming Language :: Python :: 3
|
|
75
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
76
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
77
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
78
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
79
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
80
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
81
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
82
|
+
Requires-Python: >=3.10
|
|
83
|
+
Requires-Dist: tzdata; sys_platform == 'win32'
|
|
84
|
+
Description-Content-Type: text/markdown
|
|
85
|
+
|
|
86
|
+
> [!NOTE]
|
|
87
|
+
> This package is rewrite of python-dateutil package with v2.9.0.post0 as base, to support active python versions only.
|
|
88
|
+
> It is not related with the base project and its authors.
|
|
89
|
+
> Docs of base project are under `.base_project/`
|
|
90
|
+
|
|
91
|
+
# dateutilx - powerful extensions to datetime
|
|
92
|
+
|
|
93
|
+
| | |
|
|
94
|
+
|----------------|---------------------------------------------------------------------------------------------|
|
|
95
|
+
| Compatibility | ![Py-Version] |
|
|
96
|
+
| Quality Checks | [![lint check][lint-badge]]() [![tests][tests-badge]]() [![pre-commit][pre-commit-badge]]() |
|
|
97
|
+
| Package | ![pypi-v] ![pypi-downloads] |
|
|
98
|
+
| MetaData | [![license-badge]][license] |
|
|
99
|
+
|
|
100
|
+
The `dateutilx` module provides powerful extensions to the standard `datetime` module, available in Python.
|
|
101
|
+
|
|
102
|
+
## Installation
|
|
103
|
+
|
|
104
|
+
`dateutilx` can be installed from PyPI using `pip`
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
pip install dateutilx
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Download
|
|
111
|
+
|
|
112
|
+
dateutilx is available on PyPI
|
|
113
|
+
https://pypi.org/project/dateutilx/
|
|
114
|
+
|
|
115
|
+
The documentation is hosted at:
|
|
116
|
+
https://dateutilx.readthedocs.io/en/stable/
|
|
117
|
+
|
|
118
|
+
## Code
|
|
119
|
+
|
|
120
|
+
The code and issue tracker are hosted on GitHub:
|
|
121
|
+
https://github.com/rsb-23/dateutilx/
|
|
122
|
+
|
|
123
|
+
## Features
|
|
124
|
+
|
|
125
|
+
* Computing of relative deltas (next month, next year, next Monday, last week of month, etc);
|
|
126
|
+
* Computing of relative deltas between two given date and/or datetime objects;
|
|
127
|
+
* Computing of dates based on very flexible recurrence rules, using a superset of
|
|
128
|
+
the [iCalendar](https://www.ietf.org/rfc/rfc2445.txt) specification. Parsing of RFC strings is supported as well.
|
|
129
|
+
* Generic parsing of dates in almost any string format;
|
|
130
|
+
* Timezone (tzinfo) implementations for tzfile(5) format files (/etc/localtime, /usr/share/zoneinfo, etc), TZ
|
|
131
|
+
environment string (in all known formats), iCalendar format files, given ranges (with help from relative deltas),
|
|
132
|
+
local machine timezone, fixed offset timezone, UTC timezone, and Windows registry-based time zones.
|
|
133
|
+
* Internal up-to-date world timezone information based on Olson's database.
|
|
134
|
+
* Computing of Easter Sunday dates for any given year, using Western, Orthodox or Julian algorithms;
|
|
135
|
+
* A comprehensive test suite.
|
|
136
|
+
|
|
137
|
+
## Quick example
|
|
138
|
+
|
|
139
|
+
Here's a snapshot, just to give an idea about the power of the
|
|
140
|
+
package. For more examples, look at the documentation.
|
|
141
|
+
|
|
142
|
+
Suppose you want to know how much time is left, in
|
|
143
|
+
years/months/days/etc, before the next easter happening on a
|
|
144
|
+
year with a Friday 13th in August, and you want to get today's
|
|
145
|
+
date out of the "date" unix system command. Here is the code:
|
|
146
|
+
|
|
147
|
+
```pycon
|
|
148
|
+
>>> from datetime import *
|
|
149
|
+
>>> from dateutilx.easter import *
|
|
150
|
+
>>> from dateutilx.parser import *
|
|
151
|
+
>>> from dateutilx.relativedelta import RelativeDelta
|
|
152
|
+
>>> from dateutilx.rrule import *
|
|
153
|
+
>>>
|
|
154
|
+
>>> now = parse("Sat Oct 11 17:13:46 UTC 2003")
|
|
155
|
+
>>> today = now.date()
|
|
156
|
+
>>> year = rrule(YEARLY, dtstart=now, bymonth=8, bymonthday=13, byweekday=FR)[0].year
|
|
157
|
+
>>> rdelta = relativedelta(easter(year), today)
|
|
158
|
+
>>> print("Today is: %s" % today)
|
|
159
|
+
"Today is: 2003-10-11"
|
|
160
|
+
>>> print("Year with next Aug 13th on a Friday is: %s" % year)
|
|
161
|
+
"Year with next Aug 13th on a Friday is: 2004"
|
|
162
|
+
>>> print("How far is the Easter of that year: %s" % rdelta)
|
|
163
|
+
"How far is the Easter of that year: RelativeDelta(months=+6)"
|
|
164
|
+
>>> print("And the Easter of that year is: %s" % (today + rdelta))
|
|
165
|
+
"And the Easter of that year is: 2004-04-11"
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Being exactly 6 months ahead was **really** a coincidence :)
|
|
169
|
+
|
|
170
|
+
## Contributing
|
|
171
|
+
|
|
172
|
+
We welcome many types of contributions - bug reports, pull requests (code, infrastructure or documentation fixes). For
|
|
173
|
+
more information about how to contribute to the project, see the `CONTRIBUTING.md` file in the repository.
|
|
174
|
+
|
|
175
|
+
## Author
|
|
176
|
+
|
|
177
|
+
The dateutil module was written by Gustavo Niemeyer <gustavo@niemeyer.net> in 2003.
|
|
178
|
+
|
|
179
|
+
It was maintained by:
|
|
180
|
+
|
|
181
|
+
* Gustavo Niemeyer <gustavo@niemeyer.net> 2003-2011
|
|
182
|
+
* Tomi Pieviläinen <tomi.pievilainen@iki.fi> 2012-2014
|
|
183
|
+
* Yaron de Leeuw <me@jarondl.net> 2014-2016
|
|
184
|
+
* Paul Ganssle <paul@ganssle.io> 2015-
|
|
185
|
+
|
|
186
|
+
## License
|
|
187
|
+
|
|
188
|
+
All contributions after December 1, 2017 released under dual license -
|
|
189
|
+
either [Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0) or
|
|
190
|
+
the [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause). Contributions before December 1, 2017 - except
|
|
191
|
+
those those explicitly relicensed - are released only under the BSD 3-Clause License.
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
[license]: https://github.com/rsb-23/dateutilx/blob/main/LICENSE
|
|
195
|
+
|
|
196
|
+
[lint-badge]: https://github.com/rsb-23/dateutilx/actions/workflows/code-lint.yml/badge.svg
|
|
197
|
+
|
|
198
|
+
[tests-badge]: https://github.com/rsb-23/dateutilx/actions/workflows/code-test.yml/badge.svg
|
|
199
|
+
|
|
200
|
+
[license-badge]: https://img.shields.io/pypi/l/dateutilx.svg?style=flat-square
|
|
201
|
+
|
|
202
|
+
[pre-commit-badge]: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white
|
|
203
|
+
|
|
204
|
+
[py-version]: https://img.shields.io/pypi/pyversions/dateutilx
|
|
205
|
+
|
|
206
|
+
[pypi-downloads]: https://img.shields.io/pypi/dm/dateutilx?label=Downloads
|
|
207
|
+
|
|
208
|
+
[pypi-v]: https://img.shields.io/pypi/v/dateutilx?label=pypi
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
> [!NOTE]
|
|
2
|
+
> This package is rewrite of python-dateutil package with v2.9.0.post0 as base, to support active python versions only.
|
|
3
|
+
> It is not related with the base project and its authors.
|
|
4
|
+
> Docs of base project are under `.base_project/`
|
|
5
|
+
|
|
6
|
+
# dateutilx - powerful extensions to datetime
|
|
7
|
+
|
|
8
|
+
| | |
|
|
9
|
+
|----------------|---------------------------------------------------------------------------------------------|
|
|
10
|
+
| Compatibility | ![Py-Version] |
|
|
11
|
+
| Quality Checks | [![lint check][lint-badge]]() [![tests][tests-badge]]() [![pre-commit][pre-commit-badge]]() |
|
|
12
|
+
| Package | ![pypi-v] ![pypi-downloads] |
|
|
13
|
+
| MetaData | [![license-badge]][license] |
|
|
14
|
+
|
|
15
|
+
The `dateutilx` module provides powerful extensions to the standard `datetime` module, available in Python.
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
`dateutilx` can be installed from PyPI using `pip`
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
pip install dateutilx
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Download
|
|
26
|
+
|
|
27
|
+
dateutilx is available on PyPI
|
|
28
|
+
https://pypi.org/project/dateutilx/
|
|
29
|
+
|
|
30
|
+
The documentation is hosted at:
|
|
31
|
+
https://dateutilx.readthedocs.io/en/stable/
|
|
32
|
+
|
|
33
|
+
## Code
|
|
34
|
+
|
|
35
|
+
The code and issue tracker are hosted on GitHub:
|
|
36
|
+
https://github.com/rsb-23/dateutilx/
|
|
37
|
+
|
|
38
|
+
## Features
|
|
39
|
+
|
|
40
|
+
* Computing of relative deltas (next month, next year, next Monday, last week of month, etc);
|
|
41
|
+
* Computing of relative deltas between two given date and/or datetime objects;
|
|
42
|
+
* Computing of dates based on very flexible recurrence rules, using a superset of
|
|
43
|
+
the [iCalendar](https://www.ietf.org/rfc/rfc2445.txt) specification. Parsing of RFC strings is supported as well.
|
|
44
|
+
* Generic parsing of dates in almost any string format;
|
|
45
|
+
* Timezone (tzinfo) implementations for tzfile(5) format files (/etc/localtime, /usr/share/zoneinfo, etc), TZ
|
|
46
|
+
environment string (in all known formats), iCalendar format files, given ranges (with help from relative deltas),
|
|
47
|
+
local machine timezone, fixed offset timezone, UTC timezone, and Windows registry-based time zones.
|
|
48
|
+
* Internal up-to-date world timezone information based on Olson's database.
|
|
49
|
+
* Computing of Easter Sunday dates for any given year, using Western, Orthodox or Julian algorithms;
|
|
50
|
+
* A comprehensive test suite.
|
|
51
|
+
|
|
52
|
+
## Quick example
|
|
53
|
+
|
|
54
|
+
Here's a snapshot, just to give an idea about the power of the
|
|
55
|
+
package. For more examples, look at the documentation.
|
|
56
|
+
|
|
57
|
+
Suppose you want to know how much time is left, in
|
|
58
|
+
years/months/days/etc, before the next easter happening on a
|
|
59
|
+
year with a Friday 13th in August, and you want to get today's
|
|
60
|
+
date out of the "date" unix system command. Here is the code:
|
|
61
|
+
|
|
62
|
+
```pycon
|
|
63
|
+
>>> from datetime import *
|
|
64
|
+
>>> from dateutilx.easter import *
|
|
65
|
+
>>> from dateutilx.parser import *
|
|
66
|
+
>>> from dateutilx.relativedelta import RelativeDelta
|
|
67
|
+
>>> from dateutilx.rrule import *
|
|
68
|
+
>>>
|
|
69
|
+
>>> now = parse("Sat Oct 11 17:13:46 UTC 2003")
|
|
70
|
+
>>> today = now.date()
|
|
71
|
+
>>> year = rrule(YEARLY, dtstart=now, bymonth=8, bymonthday=13, byweekday=FR)[0].year
|
|
72
|
+
>>> rdelta = relativedelta(easter(year), today)
|
|
73
|
+
>>> print("Today is: %s" % today)
|
|
74
|
+
"Today is: 2003-10-11"
|
|
75
|
+
>>> print("Year with next Aug 13th on a Friday is: %s" % year)
|
|
76
|
+
"Year with next Aug 13th on a Friday is: 2004"
|
|
77
|
+
>>> print("How far is the Easter of that year: %s" % rdelta)
|
|
78
|
+
"How far is the Easter of that year: RelativeDelta(months=+6)"
|
|
79
|
+
>>> print("And the Easter of that year is: %s" % (today + rdelta))
|
|
80
|
+
"And the Easter of that year is: 2004-04-11"
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Being exactly 6 months ahead was **really** a coincidence :)
|
|
84
|
+
|
|
85
|
+
## Contributing
|
|
86
|
+
|
|
87
|
+
We welcome many types of contributions - bug reports, pull requests (code, infrastructure or documentation fixes). For
|
|
88
|
+
more information about how to contribute to the project, see the `CONTRIBUTING.md` file in the repository.
|
|
89
|
+
|
|
90
|
+
## Author
|
|
91
|
+
|
|
92
|
+
The dateutil module was written by Gustavo Niemeyer <gustavo@niemeyer.net> in 2003.
|
|
93
|
+
|
|
94
|
+
It was maintained by:
|
|
95
|
+
|
|
96
|
+
* Gustavo Niemeyer <gustavo@niemeyer.net> 2003-2011
|
|
97
|
+
* Tomi Pieviläinen <tomi.pievilainen@iki.fi> 2012-2014
|
|
98
|
+
* Yaron de Leeuw <me@jarondl.net> 2014-2016
|
|
99
|
+
* Paul Ganssle <paul@ganssle.io> 2015-
|
|
100
|
+
|
|
101
|
+
## License
|
|
102
|
+
|
|
103
|
+
All contributions after December 1, 2017 released under dual license -
|
|
104
|
+
either [Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0) or
|
|
105
|
+
the [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause). Contributions before December 1, 2017 - except
|
|
106
|
+
those those explicitly relicensed - are released only under the BSD 3-Clause License.
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
[license]: https://github.com/rsb-23/dateutilx/blob/main/LICENSE
|
|
110
|
+
|
|
111
|
+
[lint-badge]: https://github.com/rsb-23/dateutilx/actions/workflows/code-lint.yml/badge.svg
|
|
112
|
+
|
|
113
|
+
[tests-badge]: https://github.com/rsb-23/dateutilx/actions/workflows/code-test.yml/badge.svg
|
|
114
|
+
|
|
115
|
+
[license-badge]: https://img.shields.io/pypi/l/dateutilx.svg?style=flat-square
|
|
116
|
+
|
|
117
|
+
[pre-commit-badge]: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white
|
|
118
|
+
|
|
119
|
+
[py-version]: https://img.shields.io/pypi/pyversions/dateutilx
|
|
120
|
+
|
|
121
|
+
[pypi-downloads]: https://img.shields.io/pypi/dm/dateutilx?label=Downloads
|
|
122
|
+
|
|
123
|
+
[pypi-v]: https://img.shields.io/pypi/v/dateutilx?label=pypi
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling", "hatch-vcs"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "dateutilx"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Modern extension to the standard Python datetime module"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { file = "LICENSE" }
|
|
11
|
+
authors = [{ name = "Rishabh B" }]
|
|
12
|
+
|
|
13
|
+
keywords = ["date", "time", "datetime", "timezone", "dateutil"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 4 - Beta",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"License :: OSI Approved :: BSD License",
|
|
18
|
+
"License :: OSI Approved :: Apache Software License",
|
|
19
|
+
"Programming Language :: Python",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Programming Language :: Python :: 3.13",
|
|
25
|
+
"Programming Language :: Python :: 3.14",
|
|
26
|
+
"Programming Language :: Python :: 3.15",
|
|
27
|
+
"Topic :: Software Development :: Libraries",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
requires-python = ">=3.10"
|
|
31
|
+
dependencies = ["tzdata; sys_platform == 'win32'"]
|
|
32
|
+
|
|
33
|
+
[dependency-groups]
|
|
34
|
+
build = ["build", "twine"]
|
|
35
|
+
lint = ["pre-commit"]
|
|
36
|
+
test = ["hypothesis", "pytest", "pytest-cov"]
|
|
37
|
+
|
|
38
|
+
[project.urls]
|
|
39
|
+
Homepage = "https://github.com/rsb-23/dateutilx"
|
|
40
|
+
Documentation = "https://dateutil.readthedocs.io/en/stable/"
|
|
41
|
+
Source = "https://github.com/rsb-23/dateutilx"
|
|
42
|
+
|
|
43
|
+
# Build Config
|
|
44
|
+
[tool.hatch.version]
|
|
45
|
+
source = "vcs"
|
|
46
|
+
[tool.hatch.build.targets.sdist]
|
|
47
|
+
include = ["src/dateutilx", "src/dateutil", "LICENSE", "README.md", "pyproject.toml"]
|
|
48
|
+
[tool.hatch.build.targets.wheel]
|
|
49
|
+
packages = ["src/dateutilx", "src/dateutil"]
|
|
50
|
+
|
|
51
|
+
[tool.coverage.report]
|
|
52
|
+
fail_under = 85.0
|
|
53
|
+
[tool.coverage.run]
|
|
54
|
+
source = ["src/"]
|
|
55
|
+
|
|
56
|
+
[tool.pytest.ini_options]
|
|
57
|
+
python_files = ["test_*.py", "*_test.py", "*_solution.py", ]
|
|
58
|
+
xfail_strict = true
|
|
59
|
+
filterwarnings = ["error", "error::DeprecationWarning", "error::PendingDeprecationWarning", ]
|
|
60
|
+
markers = [
|
|
61
|
+
"gettz", "import_star", "isoparser", "parserinfo", "rrule", "rruleset", "rrulestr",
|
|
62
|
+
"smoke", "tz_resolve_imaginary", "tzfile", "tzlocal", "tzoffset", "tzstr",
|
|
63
|
+
]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
|
|
3
|
+
try:
|
|
4
|
+
from .info import __version__
|
|
5
|
+
except ImportError:
|
|
6
|
+
__version__ = "unknown"
|
|
7
|
+
|
|
8
|
+
__all__ = ["easter", "parser", "relativedelta", "rrule", "tz", "utils"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def __getattr__(name):
|
|
12
|
+
import importlib
|
|
13
|
+
|
|
14
|
+
if name in __all__:
|
|
15
|
+
return importlib.import_module(f".{name}", __name__)
|
|
16
|
+
raise AttributeError(f"module {__name__!r} has not attribute {name!r}")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def __dir__():
|
|
20
|
+
# __dir__ should include all the lazy-importable modules as well.
|
|
21
|
+
return [x for x in globals() if x not in sys.modules] + __all__
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module offers a generic Easter computing method for any given year, using
|
|
3
|
+
Western, Orthodox or Julian algorithms.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import datetime
|
|
7
|
+
from enum import IntEnum
|
|
8
|
+
|
|
9
|
+
__all__ = ["easter", "EasterAlgo"]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class EasterAlgo(IntEnum):
|
|
13
|
+
JULIAN = 1
|
|
14
|
+
ORTHODOX = 2
|
|
15
|
+
WESTERN = 3
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def easter(year, method: EasterAlgo | int = EasterAlgo.WESTERN):
|
|
19
|
+
"""
|
|
20
|
+
This method was ported from the work done by GM Arts,
|
|
21
|
+
on top of the algorithm by Claus Tondering, which was
|
|
22
|
+
based in part on the algorithm of Ouding (1940), as
|
|
23
|
+
quoted in "Explanatory Supplement to the Astronomical
|
|
24
|
+
Almanac", P. Kenneth Seidelmann, editor.
|
|
25
|
+
|
|
26
|
+
This algorithm implements three different Easter
|
|
27
|
+
calculation methods:
|
|
28
|
+
|
|
29
|
+
1. Original calculation in Julian calendar, valid in
|
|
30
|
+
dates after 326 AD
|
|
31
|
+
2. Original method, with date converted to Gregorian
|
|
32
|
+
calendar, valid in years 1583 to 4099
|
|
33
|
+
3. Revised method, in Gregorian calendar, valid in
|
|
34
|
+
years 1583 to 4099 as well
|
|
35
|
+
|
|
36
|
+
These methods are represented by the constants:
|
|
37
|
+
|
|
38
|
+
* ``EASTER_JULIAN = 1``
|
|
39
|
+
* ``EASTER_ORTHODOX = 2``
|
|
40
|
+
* ``EASTER_WESTERN = 3``
|
|
41
|
+
|
|
42
|
+
The default method is method 3.
|
|
43
|
+
|
|
44
|
+
More about the algorithm may be found at:
|
|
45
|
+
|
|
46
|
+
`GM Arts: Easter Algorithms <https://www.gmarts.org/index.php?go=415>`_
|
|
47
|
+
|
|
48
|
+
and
|
|
49
|
+
|
|
50
|
+
`The Calendar FAQ: Easter <https://www.tondering.dk/claus/cal/easter.php>`_
|
|
51
|
+
|
|
52
|
+
"""
|
|
53
|
+
# todo: simplify for base 3.12
|
|
54
|
+
try:
|
|
55
|
+
EasterAlgo(method)
|
|
56
|
+
except ValueError as e:
|
|
57
|
+
raise ValueError("invalid Easter method") from e
|
|
58
|
+
|
|
59
|
+
# g - Golden year - 1
|
|
60
|
+
# c - Century
|
|
61
|
+
# h - (23 - Epact) mod 30
|
|
62
|
+
# i - Number of days from March 21 to Paschal Full Moon
|
|
63
|
+
# j - Weekday for PFM (0=Sunday, etc)
|
|
64
|
+
# p - Number of days from March 21 to Sunday on or before PFM
|
|
65
|
+
# (-6 to 28 methods 1 & 3, to 56 for method 2)
|
|
66
|
+
# e - Extra days to add for method 2 (converting Julian
|
|
67
|
+
# date to Gregorian date)
|
|
68
|
+
|
|
69
|
+
y = year
|
|
70
|
+
g = y % 19
|
|
71
|
+
e = 0
|
|
72
|
+
if method < 3:
|
|
73
|
+
# Old method
|
|
74
|
+
i = (19 * g + 15) % 30
|
|
75
|
+
j = (y + y // 4 + i) % 7
|
|
76
|
+
if method == 2:
|
|
77
|
+
# Extra dates to convert Julian to Gregorian date
|
|
78
|
+
e = 10
|
|
79
|
+
if y > 1600:
|
|
80
|
+
e = e + y // 100 - 16 - (y // 100 - 16) // 4
|
|
81
|
+
else:
|
|
82
|
+
# New method
|
|
83
|
+
c = y // 100
|
|
84
|
+
h = (c - c // 4 - (8 * c + 13) // 25 + 19 * g + 15) % 30
|
|
85
|
+
i = h - (h // 28) * (1 - (h // 28) * (29 // (h + 1)) * ((21 - g) // 11))
|
|
86
|
+
j = (y + y // 4 + i + 2 - c + c // 4) % 7
|
|
87
|
+
|
|
88
|
+
# p can be from -6 to 56 corresponding to dates 22 March to 23 May
|
|
89
|
+
# (later dates apply to method 2, although 23 May never actually occurs)
|
|
90
|
+
p = i - j + e
|
|
91
|
+
d = 1 + (p + 27 + (p + 6) // 40) % 31
|
|
92
|
+
m = 3 + (p + 26) // 30
|
|
93
|
+
return datetime.date(int(y), int(m), int(d))
|