🏹 Better dates & times for Python

Overview

Arrow: Better dates & times for Python

Build Status Coverage PyPI Version Supported Python Versions License Code Style: Black

Arrow is a Python library that offers a sensible and human-friendly approach to creating, manipulating, formatting and converting dates, times and timestamps. It implements and updates the datetime type, plugging gaps in functionality and providing an intelligent module API that supports many common creation scenarios. Simply put, it helps you work with dates and times with fewer imports and a lot less code.

Arrow is named after the arrow of time and is heavily inspired by moment.js and requests.

Why use Arrow over built-in modules?

Python's standard library and some other low-level modules have near-complete date, time and timezone functionality, but don't work very well from a usability perspective:

  • Too many modules: datetime, time, calendar, dateutil, pytz and more
  • Too many types: date, time, datetime, tzinfo, timedelta, relativedelta, etc.
  • Timezones and timestamp conversions are verbose and unpleasant
  • Timezone naivety is the norm
  • Gaps in functionality: ISO 8601 parsing, timespans, humanization

Features

  • Fully-implemented, drop-in replacement for datetime
  • Support for Python 3.6+
  • Timezone-aware and UTC by default
  • Super-simple creation options for many common input scenarios
  • shift method with support for relative offsets, including weeks
  • Format and parse strings automatically
  • Wide support for the ISO 8601 standard
  • Timezone conversion
  • Support for dateutil, pytz, and ZoneInfo tzinfo objects
  • Generates time spans, ranges, floors and ceilings for time frames ranging from microsecond to year
  • Humanize dates and times with a growing list of contributed locales
  • Extensible for your own Arrow-derived types
  • Full support for PEP 484-style type hints

Quick Start

Installation

To install Arrow, use pip or pipenv:

$ pip install -U arrow

Example Usage

>>> import arrow
>>> arrow.get('2013-05-11T21:23:58.970460+07:00')
<Arrow [2013-05-11T21:23:58.970460+07:00]>

>>> utc = arrow.utcnow()
>>> utc
<Arrow [2013-05-11T21:23:58.970460+00:00]>

>>> utc = utc.shift(hours=-1)
>>> utc
<Arrow [2013-05-11T20:23:58.970460+00:00]>

>>> local = utc.to('US/Pacific')
>>> local
<Arrow [2013-05-11T13:23:58.970460-07:00]>

>>> local.timestamp()
1368303838.970460

>>> local.format()
'2013-05-11 13:23:58 -07:00'

>>> local.format('YYYY-MM-DD HH:mm:ss ZZ')
'2013-05-11 13:23:58 -07:00'

>>> local.humanize()
'an hour ago'

>>> local.humanize(locale='ko-kr')
'한시간 전'

Documentation

For full documentation, please visit arrow.readthedocs.io.

Contributing

Contributions are welcome for both code and localizations (adding and updating locales). Begin by gaining familiarity with the Arrow library and its features. Then, jump into contributing:

  1. Find an issue or feature to tackle on the issue tracker. Issues marked with the "good first issue" label may be a great place to start!
  2. Fork this repository on GitHub and begin making changes in a branch.
  3. Add a few tests to ensure that the bug was fixed or the feature works as expected.
  4. Run the entire test suite and linting checks by running one of the following commands: tox && tox -e lint,docs (if you have tox installed) OR make build39 && make test && make lint (if you do not have Python 3.9 installed, replace build39 with the latest Python version on your system).
  5. Submit a pull request and await feedback 😃 .

If you have any questions along the way, feel free to ask them here.

Support Arrow

Open Collective is an online funding platform that provides tools to raise money and share your finances with full transparency. It is the platform of choice for individuals and companies to make one-time or recurring donations directly to the project. If you are interested in making a financial contribution, please visit the Arrow collective.

Comments
  • v0.15.0 Changes❗

    v0.15.0 Changes❗

    In the upcoming version 0.15.0 of arrow, we will be making a lot of changes to the behavior of arrow.get() to address a number of reported parsing bugs. We have outlined the changes below:

    Fixes

    • Most instances of arrow.get() returning an incorrect arrow object from a partial parsing match have been eliminated.

    For example,

    >>> arrow.get("garbage2017everywhere")
    <Arrow [2017-01-01T00:00:00+00:00]>
    
    >>> arrow.get('Jun-2019', ['MMM-YY', 'MMM-YYYY'])
    <Arrow [2020-06-01T00:00:00+00:00]>
    

    These will raise a ParserError in 0.15.0.

    • When a meridian token (a|A) is passed and no meridians are available for the specified locale (e.g. unsupported or untranslated), a ParserError is raised.
    • Timestamp strings are no longer supported in the arrow.get() method without a format string: arrow.get("1565358758"). This change was made to support the ISO 8601 basic format and to address bugs such as https://github.com/crsmithdev/arrow/issues/447.

    The following will still work as expected:

    arrow.get("1565358758", "X")
    arrow.get("1565358758.123413", "X")
    arrow.get(1565358758)
    arrow.get(1565358758.123413)
    
    • The timestamp token (X) will now matches float timestamps: arrow.get("1565358758.123415", "X").
    • The timestamp token (X) will now only match on strings that strictly contain integers and floats, preventing incorrect matches.

    New Features

    • ISO-8601 basic format style is now supported (e.g. YYYYMMDDThhmmssZ)
    • Added support for DDD and DDDD ordinal date tokens (e.g. "1998-045")

    Issues addressed

    • https://github.com/crsmithdev/arrow/issues/560
    • https://github.com/crsmithdev/arrow/issues/538
    • https://github.com/crsmithdev/arrow/issues/434
    • https://github.com/crsmithdev/arrow/issues/519
    • https://github.com/crsmithdev/arrow/issues/91
    • https://github.com/crsmithdev/arrow/issues/447
    • https://github.com/crsmithdev/arrow/issues/196
    • https://github.com/crsmithdev/arrow/issues/456
    • https://github.com/crsmithdev/arrow/issues/396

    Development progress

    You can view the progress of these changes here: https://github.com/crsmithdev/arrow/tree/Version-0.15.0.

    Disable Warnings

    To get rid of the ArrowParseWarning messages in 0.14.3 onwards, do the following:

    import warnings
    from arrow.factory import ArrowParseWarning
    
    warnings.simplefilter("ignore", ArrowParseWarning)
    
    note 
    opened by jadchaar 52
  • Broken Python 2.x support in new release 0.11.0

    Broken Python 2.x support in new release 0.11.0

    Hello,

    New release (0.11.0) is broken for Python 2.x users, below you can find steps to reproduce:

    ~/.virtualenvs/tmp-455f8c1518baad7 via tmp-455f8c1518baad7
    ➔ python --version
    Python 2.7.14
    
    ~/.virtualenvs/tmp-455f8c1518baad7 via tmp-455f8c1518baad7
    ➔ pip install arrow
    Collecting arrow
    Collecting python-dateutil (from arrow)
      Using cached python_dateutil-2.6.1-py2.py3-none-any.whl
    Collecting six>=1.5 (from python-dateutil->arrow)
      Using cached six-1.11.0-py2.py3-none-any.whl
    Installing collected packages: six, python-dateutil, arrow
    Successfully installed arrow-0.11.0 python-dateutil-2.6.1 six-1.11.0
    
    ~/.virtualenvs/tmp-455f8c1518baad7 via tmp-455f8c1518baad7
    ➔ python
    Python 2.7.14 (default, Sep 25 2017, 09:53:22)
    [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import arrow
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/Users/ng/.virtualenvs/tmp-455f8c1518baad7/lib/python2.7/site-packages/arrow/__init__.py", line 3, in <module>
        from .arrow import Arrow
      File "/Users/ng/.virtualenvs/tmp-455f8c1518baad7/lib/python2.7/site-packages/arrow/arrow.py", line 19, in <module>
        from arrow import util, locales, parser, formatter
      File "/Users/ng/.virtualenvs/tmp-455f8c1518baad7/lib/python2.7/site-packages/arrow/parser.py", line 12, in <module>
        from backports.functools_lru_cache import lru_cache  # pragma: no cover
    ImportError: No module named backports.functools_lru_cache
    >>>
    

    Could you fix this please?

    bug unconfirmed 
    opened by Gr1N 44
  • Wrong result when a shift involves a DST change.

    Wrong result when a shift involves a DST change.

    In paris in 2013, we changed to DST in 2013-03-31 (at 2 AM it was 3 AM), from UTC+1 to UTC+2 (DST)

    Here's an example of the issue I have with arrow :

    >>> import arrow, datetime
    
    >>> just_before = arrow.get(datetime.datetime(2013, 03, 31, 1, 50, 45), "Europe/Paris").ceil("hour")
    >>> just_before
    <Arrow [2013-03-31T01:59:59.999999+01:00]>
    
    >>> just_after = just_before.replace(microseconds=+1)
    >>> just_after
    <Arrow [2013-03-31T02:00:00+02:00]>
    >>> # That is not right... It should be either 2 AM UTC+1 or preferably  3AM UTC +2
    >>> # One could argue that depending on what you ask for, it may be the correct answer, but then the following is :
    
    >>> (just_after - just_before).total_seconds()
    1e-06
    >>> # That is right but not consistent with the dates
    
    >>> (just_after.to("utc") - just_before.to("utc").total_seconds()
    -3599.999999
    # That should be the same value as the previous computation. Plus, the value is negative because :
    
    >>> just_before.to('utc'), just_after.to('utc')
    (<Arrow [2013-03-31T00:59:59.999999+00:00]>,
     <Arrow [2013-03-31T00:00:00+00:00]>)
    

    I think the problem is pretty clear...

    bug 
    opened by ewjoachim 36
  • Roadmap and ideas for arrow 🤔

    Roadmap and ideas for arrow 🤔

    This thread was originally opened to request GitHub release and changelogs. That has been done, and the thread is now used as roadmap and ideas. Scroll to the bottom to see them. Thanks @crsmithdev and maintainers!

    opened by danqing 28
  • How to get more from arrow?

    How to get more from arrow?

    Hi! First of all, I would like to say that arrow is very well done and suits very well for almost everything a programmer wants. The only step back in arrow, IMHO (or to my necessity), is the "factory" design for getting an instance of the Arrow class. Why? I just want to extend Arrow's class to add some of methods I often use in datetime conversions / comparison :) If I choose to inherit Arrow, I would have to duplicate everything from "api" OR monkey patch it - which I don't like at all. Any ideas on how to circumvent this? Maybe a register method in the "api" for Arrow' subclasses? I can help with that, if possible :)

    Best regards, Richard.

    opened by vltr 28
  • Make start of week adjustable when using span

    Make start of week adjustable when using span

    …ng span in combination with frame == "week"

    Pull Request Checklist

    Thank you for taking the time to improve Arrow! Before submitting your pull request, please check all appropriate boxes:

    • [x] 🧪 Added tests for changed code.
    • [ ] 🛠️ All tests pass when run locally (run tox or make test to find out!). --> see comments below
    • [ ] 🧹 All linting checks pass when run locally (run tox -e lint or make lint to find out!). --> see comment below
    • [x] 📚 Updated documentation for changed code.
    • [x] ⏩ Code is up-to-date with the master branch.

    If you have any questions about your code changes or any of the points above, please submit your questions along with the pull request and we will try our best to help!

    Description of Changes

    Closes: #355 This is my first PR and I choose this issue because it was labeled as 'good first issue'. I added a new parameter weekday that can be used in combination with frame == "week" to choose a start day for arrow.span().

    My tests weren't successful. There was an issue with Python3.6 and an error. I ran the tests again against the master code and encountered the same error, see screenshots:

    Master Error: grafik Master Summary:

    grafik

    These where the only problems I encountered after implementing my changes.

    Furthermore I had problems running the linting, I got the following message: grafik

    I hope we can resolve these issues. Thank you and kind regards.

    opened by ALee008 27
  • 'datetime.timedelta' object has no attribute 'tzinfo' on windows 10

    'datetime.timedelta' object has no attribute 'tzinfo' on windows 10

    Issue Description

    This is a bit specific, but I'm grasping for straws at this point. So I'm using arrow via a kodi script. And it works without problems on linux. A team member tried using my script on windows 10, he get's this stack trace.

    2019-12-14 10:29:01.961 T:1472   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                 - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                Error Type: <class 'AttributeError'>
                                                Error Contents: 'datetime.timedelta' object has no attribute 'tzinfo'
                                                Traceback (most recent call last):
                                                  File "C:\KODI\KODI- v19 nightlies\portable_data\addons\metadata.tvdb.com.python\scraper.py", line 3, in <module>
                                                    from resources.lib import actions
                                                  File "C:\KODI\KODI- v19 nightlies\portable_data\addons\metadata.tvdb.com.python\resources\lib\actions.py", line 10, in <module>
                                                    from . import series
                                                  File "C:\KODI\KODI- v19 nightlies\portable_data\addons\metadata.tvdb.com.python\resources\lib\series.py", line 11, in <module>
                                                    from .ratings import ratings
                                                  File "C:\KODI\KODI- v19 nightlies\portable_data\addons\metadata.tvdb.com.python\resources\lib\ratings.py", line 6, in <module>
                                                    from .trakt_rating import get_trakt_rating_and_votes
                                                  File "C:\KODI\KODI- v19 nightlies\portable_data\addons\metadata.tvdb.com.python\resources\lib\trakt_rating.py", line 1, in <module>
                                                    from trakt import Trakt
                                                  File "C:\KODI\KODI- v19 nightlies\portable_data\addons\script.module.trakt\lib\trakt\__init__.py", line 3, in <module>
                                                    from trakt.client import TraktClient
                                                  File "C:\KODI\KODI- v19 nightlies\portable_data\addons\script.module.trakt\lib\trakt\client.py", line 3, in <module>
                                                    from trakt.core.configuration import ConfigurationManager
                                                  File "C:\KODI\KODI- v19 nightlies\portable_data\addons\script.module.trakt\lib\trakt\core\configuration.py", line 3, in <module>
                                                    from trakt.core.context_collection import ContextCollection
                                                  File "C:\KODI\KODI- v19 nightlies\portable_data\addons\script.module.trakt\lib\trakt\core\context_collection.py", line 3, in <module>
                                                    from trakt.core.helpers import synchronized
                                                  File "C:\KODI\KODI- v19 nightlies\portable_data\addons\script.module.trakt\lib\trakt\core\helpers.py", line 9, in <module>
                                                    import arrow
                                                  File "C:\KODI\KODI- v19 nightlies\portable_data\addons\script.module.arrow\lib\arrow\__init__.py", line 3, in <module>
                                                    from .api import get, now, utcnow
                                                  File "C:\KODI\KODI- v19 nightlies\portable_data\addons\script.module.arrow\lib\arrow\api.py", line 10, in <module>
                                                    from arrow.factory import ArrowFactory
                                                  File "C:\KODI\KODI- v19 nightlies\portable_data\addons\script.module.arrow\lib\arrow\factory.py", line 19, in <module>
                                                    from arrow.arrow import Arrow
                                                  File "C:\KODI\KODI- v19 nightlies\portable_data\addons\script.module.arrow\lib\arrow\arrow.py", line 1396, in <module>
                                                    Arrow.max = Arrow.fromdatetime(datetime.max)
                                                  File "C:\KODI\KODI- v19 nightlies\portable_data\addons\script.module.arrow\lib\arrow\arrow.py", line 217, in fromdatetime
                                                    if dt.tzinfo is None:
                                                AttributeError: 'datetime.timedelta' object has no attribute 'tzinfo'
                                                -->End of Python script error report<--
    

    System Info

    • 🖥 OS name and version: Running on Windows 10, kernel: Windows NT x86 64-bit version 10.0.18362
    • 🐍 Python version: 3.7 (this might be connected as my linux system is already running 3.8)
    • 🏹 Arrow version: 0.15.4
    bug 
    opened by razzeee 24
  • Allow escaping of characters in format()

    Allow escaping of characters in format()

    In French, hours are formatted as "8 h 40" and not as "8:40". But in an arrow's format string, h displays directly the hours. Would it be possible to add a key (such as !) to force h to be displayed normally ("hh !h mm")?

    enhancement 
    opened by cynddl 20
  • Tokens A/hh seem to work on invalid time stamps

    Tokens A/hh seem to work on invalid time stamps

    Issue Description

    Arrow does not seem to perform validation on timestamps for unusual formats where the information conflicts.

    The following code snippet runs just fine:

    >>> arrow.get("2021-01-30 14:00:00 AM", "YYYY-MM-DD hh:mm:ss A")
    <Arrow [2021-01-30T14:00:00+00:00]>
    

    First of all, since hh is documented to go to a maximum value of 12, I expect arrow to raise an error because the value is 14. Secondly, I expect arrow to notice that 14:00:00 (2 PM) conflicts with the string "AM".

    Is this behaviour intentional? Or is it a bug?

    System Info

    • 🖥 OS name and version: macOS 11.2.3
    • 🐍 Python version: Python 3.7.8
    • 🏹 Arrow version: 1.0.3
    bug good first issue 
    opened by tlitetrasci 19
  • Get ready for Python 2 EOL

    Get ready for Python 2 EOL

    Python 2 is reaching EOL in 2020 (https://pythonclock.org/).

    Me and @jadchaar have chatted about this before but haven't come to a decision yet. We'd hoped that the DST upgrades would be done before the EOL so Python 2.7 users would at least have access to those improvements. However due to being busy we've not had time to work on that.

    An important factor in this decision will be how long travis-ci supports 2.7.

    dateutil discussion - https://github.com/dateutil/dateutil/issues/653

    @hugovk do you have any thoughts or stats on Python 2.7 usage?

    note 
    opened by systemcatch 18
  • The docs don’t make clear how to parse an ISO-8601 datetime string

    The docs don’t make clear how to parse an ISO-8601 datetime string

    I’ve been perusing the docs for 10 minutes now trying to figure this out. I’d think it’s a common-enough use case that it should have an example in the docs.

    It seems I should use arrow.get(datetime_string, pattern_string) but I don’t know what syntax to use for the pattern, and the docs don’t say what syntax is used so I can’t look it up.

    So, some suggestions:

    1. add an example of parsing an ISO-8601 datetime string (with an offset)
    2. add a link to the docs for the pattern syntax
    3. add a module containing some “constants” with common datetime pattern strings
    opened by aviflax 17
  • I added on function called time_diff() on the arrow.py file to count the time difference in different time zone

    I added on function called time_diff() on the arrow.py file to count the time difference in different time zone

    Pull Request Checklist

    Thank you for taking the time to improve Arrow! Before submitting your pull request, please check all appropriate boxes:

    • [ ] 🧪 Added tests for changed code.
    • [ ] 🛠️ All tests pass when run locally (run tox or make test to find out!).
    • [ ] 🧹 All linting checks pass when run locally (run tox -e lint or make lint to find out!).
    • [ ] 📚 Updated documentation for changed code.
    • [ ] ⏩ Code is up-to-date with the master branch.

    If you have any questions about your code changes or any of the points above, please submit your questions along with the pull request and we will try our best to help!

    Description of Changes

    Hi, I am a new contributor here. I added on function called time_diff() on the arrow.py file to count the time difference in different time zone. I passed all of the test on local.

    opened by kadeng14 0
  • passing a parameter to Arrow.shift function (to check for imaginary times or not)

    passing a parameter to Arrow.shift function (to check for imaginary times or not)

    The shift function takes some time than absolute adding of relativedelta to datetime. If I am operating on a range where I know there is no dst change I should be able to bypass this check.

    enhancement 
    opened by not-so-rabh 0
  • Pandas Timestamp from Arrow Object

    Pandas Timestamp from Arrow Object

    Issue Description

    I read #755 and thought that Arrow objects supposed to work with pandas TimeStamp object. However, I couldn't get them to work together without accessing the property "naive".

    The Arrow objects couldn't be parsed using pd.to_datetime I couldn't sliced pandas Timestamp using Arrow objects as well. Is this how it's supposed to be?

    I really like arrow that I can get the floor and ceiling of a frame so fast, however, it's kind of quirky to have to access .naive everytime I interact with pandas

    System Info

    • 🖥 OS name and version: Debian Linux 11.5
    • 🐍 Python version: 3.10.6
    • 🏹 Arrow version: 1.2.3
    bug 
    opened by NikkiSatmaka 0
  • Add Cython Support to Arrow

    Add Cython Support to Arrow

    Pull Request Checklist

    Thank you for taking the time to improve Arrow! Before submitting your pull request, please check all appropriate boxes:

    • [ ] 🧪 Added tests for changed code.
    • [x] 🛠️ All tests pass when run locally (run tox or make test to find out!).
    • [x] 🧹 All linting checks pass when run locally (run tox -e lint or make lint to find out!).
    • [ ] 📚 Updated documentation for changed code.
    • [x] ⏩ Code is up-to-date with the master branch.

    If you have any questions about your code changes or any of the points above, please submit your questions along with the pull request and we will try our best to help!

    Description of Changes

    These changes were made in collaboration with @khanm3

    • Modified the setup file so that the entire Arrow library is compiled using Cython
    • Modified the tox.ini file to support code coverage with Cython
    • Added Cython 3.0.0a11 to the requirements.txt
    • Modified arrow.py to compile with Cython and pass the test suite
    • Modified an existing test case to work with Cython since the mocking was broken from Cython caching builtins
    • Added a Makefile target to compile with Cython

    This pull request adds Cython support to Arrow as requested by #617.

    Further Explanation

    In arrow/arrow.py, we had to change the variable "locale" to "locale_cls" because the variable was being reused for 2 different types and this functionality was incompatible with Cython. Cython also had difficulties recognizing the type of _datetime.isoclanedar, so we had to specifically cast it to a tuple. Without this, it would not compile.

    Even with the issues mentioned above, we chose to use Cython 3.0.0a11 (which is a pre-release version) instead of Cython 0.29.32 (the most recent stable version), since from our testing, Cython 3 is better at parsing modern Python features. In general, Cython tries to subsume the functionality of python, but as you can see there are still many quirks.

    We were able to allow Cython to use the existing method of calculating code coverage by adding linetracing as a compiler directive. However, due to the quirks of Cython, the resulting line coverage results are slightly lower than 100%. We found that the lines that were no longer being covered were one of 2 cases:

    1. Inside an if statement that had 'pragma no cover' (so those also shouldn't count towards coverage)
    2. Parameters to functions that had a default value (which also shouldn't count towards coverage, but for some reason Cython thinks it should)

    This could be ignored by adding more 'pragma no cover', but we're not sure if there is a better way.

    Performance Analysis

    To compare performance of Arrow with and without Cython, we ran just the Arrow part of this benchmark. This benchmark runs 1 million executions per benchmark and picked the min of 5 repeats. This was run in Python 3.8.10.

    arrow_benchmark

    From these results, you can see that compiling Arrow with Cython does cause a measureable improvement to performance, especially with parsing. Additionally, compiling Cython without linetracing is even more performant, but we currently compile with it so that code coverage can be calculated.

    Future Work

    Adding static typing (and necessarily converting those files to .pyx files) would bring an even bigger boost to performance. Parser.py should receive special attention, as this is where the largest amount of time is being spent. This is where adding Cython to Arrow could prove to be especially valuable, since the speed increase with static typing should be much more than that gained by simply compiling with Cython. Looking into different ways of calculating code coverage so linetracing is no longer needed, or providing an option to switch the compiler directive would also be a good way to improve performance in the future.

    opened by 13MK3 5
  • Force exact match on .get()

    Force exact match on .get()

    Pull Request Checklist

    Thank you for taking the time to improve Arrow! Before submitting your pull request, please check all appropriate boxes:

    • [x] 🧪 Added tests for changed code.
    • [x] 🛠️ All tests pass when run locally (run tox or make test to find out!).
    • [x] 🧹 All linting checks pass when run locally (run tox -e lint or make lint to find out!).
    • [ ] 📚 Updated documentation for changed code.
    • [x] ⏩ Code is up-to-date with the master branch.

    If you have any questions about your code changes or any of the points above, please submit your questions along with the pull request and we will try our best to help!

    Description of Changes

    These changes were made in collaboration with @khanm3

    • Modified the _ONE_OR_TWO_DIGIT_RE regex to not accept numbers with leading zeros. This is done in order to conform to the expected behavior and throw an error when, for example, you try to match '01' with 'M'. The issue #1084 only mentions the 'M' token, but realized that the 'D', 'H', 'm', 'h', and 's' have similar behavior which we have also corrected.
    • Modified an existing test case since this test was using the undesired behavior which this pull request is intended to fix
    • Added a test case which checks the expected behavior for all 6 tokens.

    Closes: #1084

    Questions:

    • We also noticed that the 'DDD' token seems to have similar behavior as well. If you try to match '001' to 'DDD', should that also be expected to fail? We left that one untouched since it uses a different regex and we weren't positive.
    • Unrelated to this pull request, but we noticed that tests/test_arrow.py::TestArrowHumanize::test_months is marked as expected to fail, but before we made any changes, it was already passing. Maybe this should be updated?
    opened by 13MK3 2
  • pylint fixes

    pylint fixes

    some tidyups for pylint

    Pull Request Checklist

    Thank you for taking the time to improve Arrow! Before submitting your pull request, please check all appropriate boxes:

    • [N/A ] 🧪 Added tests for changed code.
    • [cannot get them to run in win ] 🛠️ All tests pass when run locally (run tox or make test to find out!).
    • [X ] 🧹 All linting checks pass when run locally (run tox -e lint or make lint to find out!).
    • [X ] 📚 Updated documentation for changed code.
    • [X ] ⏩ Code is up-to-date with the master branch.

    If you have any questions about your code changes or any of the points above, please submit your questions along with the pull request and we will try our best to help!

    Description of Changes

    Some tidyups with pylint, and black also fixed some stuff on pre-commits.

    opened by marksmayo 1
Releases(1.2.2)
  • 1.2.2(Jan 27, 2022)

    • [NEW] Added Kazakh locale.
    • [FIX] The Belarusian, Bulgarian, Czech, Macedonian, Polish, Russian, Slovak and Ukrainian locales now support dehumanize.
    • [FIX] Minor bug fixes and improvements to ChineseCN, Indonesian, Norwegian, and Russian locales.
    • [FIX] Expanded testing for multiple locales.
    • [INTERNAL] Started using xelatex for pdf generation in documentation.
    • [INTERNAL] Split requirements file into requirements.txt, requirements-docs.txt and requirements-tests.txt.
    • [INTERNAL] Added flake8-annotations package for type linting in pre-commit.
    Source code(tar.gz)
    Source code(zip)
  • 1.2.1(Oct 24, 2021)

    • [NEW] Added quarter granularity to humanize, for example:
        >>> import arrow
        >>> now = arrow.now()
        >>> four_month_shift = now.shift(months=4)
        >>> now.humanize(four_month_shift, granularity="quarter")
        'a quarter ago'
        >>> four_month_shift.humanize(now, granularity="quarter")
        'in a quarter'
        >>> thirteen_month_shift = now.shift(months=13)
        >>> thirteen_month_shift.humanize(now, granularity="quarter")
        'in 4 quarters'
        >>> now.humanize(thirteen_month_shift, granularity="quarter")
        '4 quarters ago'
    
    • [NEW] Added Sinhala and Urdu locales.
    • [NEW] Added official support for Python 3.10.
    • [CHANGED] Updated Azerbaijani, Hebrew, and Serbian locales and added tests.
    • [CHANGED] Passing an empty granularity list to humanize now raises a ValueError.

    Commits since last release

    • Fixing plural of years and days in Hebrew by @guyernest in https://github.com/arrow-py/arrow/pull/1042
    • add Sinhala locale by @ChingYi-AX in https://github.com/arrow-py/arrow/pull/1044
    • Fix pypy CI issues and begin testing against Python 3.10 by @jadchaar in https://github.com/arrow-py/arrow/pull/1045
    • add Urdu locale by @cyriaka90 in https://github.com/arrow-py/arrow/pull/1046
    • Add support for Python 3.10 by @jadchaar in https://github.com/arrow-py/arrow/pull/1049
    • Update dependencies for Python 3.10 by @jadchaar in https://github.com/arrow-py/arrow/pull/1050
    • Corrections in Serbian locale by @smarkovic in https://github.com/arrow-py/arrow/pull/1047
    • Fix typos by @kianmeng in https://github.com/arrow-py/arrow/pull/1051
    • Declare support for Python 3.10 by @hugovk in https://github.com/arrow-py/arrow/pull/1053
    • Issue 985 -- Add Azerbaijani second time frame by @sania-dsouza in https://github.com/arrow-py/arrow/pull/1052
    • Add quarter granularity by @Alig1493 in https://github.com/arrow-py/arrow/pull/1048
    • Added Error Checking For Empty Granularity List by @anishnya in https://github.com/arrow-py/arrow/pull/1016
    • Bump version to 1.2.1 and update CHANGELOG by @jadchaar in https://github.com/arrow-py/arrow/pull/1055

    New Contributors

    • @guyernest made their first contribution in https://github.com/arrow-py/arrow/pull/1042
    • @smarkovic made their first contribution in https://github.com/arrow-py/arrow/pull/1047
    • @kianmeng made their first contribution in https://github.com/arrow-py/arrow/pull/1051
    • @sania-dsouza made their first contribution in https://github.com/arrow-py/arrow/pull/1052
    • @Alig1493 made their first contribution in https://github.com/arrow-py/arrow/pull/1048

    Full Diff: https://github.com/arrow-py/arrow/compare/1.2.0...1.2.1

    Source code(tar.gz)
    Source code(zip)
  • 1.2.0(Oct 22, 2021)

    • [NEW] Added Albanian, Tamil and Zulu locales.
    • [NEW] Added support for Decimal as input to arrow.get().
    • [FIX] The Estonian, Finnish, Nepali and Zulu locales now support dehumanize.
    • [FIX] Improved validation checks when using parser tokens A and hh.
    • [FIX] Minor bug fixes to Catalan, Cantonese, Greek and Nepali locales.
    Source code(tar.gz)
    Source code(zip)
  • 1.1.1(Jun 24, 2021)

    • [NEW] Added Odia, Maltese, Serbian, Sami, and Luxembourgish locales.
    • [FIXED] All calls to arrow.get() should now properly pass the tzinfo argument to the Arrow constructor. See PR #968 for more info.
    • [FIXED] Humanize output is now properly truncated when a locale class overrides _format_timeframe().
    • [CHANGED] Renamed requirements.txt to requirements-dev.txt to prevent confusion with the dependencies in setup.py.
    • [CHANGED] Updated Turkish locale and added tests.
    Source code(tar.gz)
    Source code(zip)
  • 1.1.0(Apr 27, 2021)

    • [NEW] Implemented the dehumanize method for Arrow objects. This takes human readable input and uses it to perform relative time shifts, for example:
        >>> arw
        <Arrow [2021-04-26T21:06:14.256803+00:00]>
        >>> arw.dehumanize("8 hours ago")
        <Arrow [2021-04-26T13:06:14.256803+00:00]>
        >>> arw.dehumanize("in 4 days")
        <Arrow [2021-04-30T21:06:14.256803+00:00]>
        >>> arw.dehumanize("in an hour 34 minutes 10 seconds")
        <Arrow [2021-04-26T22:40:24.256803+00:00]>
        >>> arw.dehumanize("hace 2 años", locale="es")
        <Arrow [2019-04-26T21:06:14.256803+00:00]>
    
    • [NEW] Made the start of the week adjustable when using span("week"), for example:
        >>> arw
        <Arrow [2021-04-26T21:06:14.256803+00:00]>
        >>> arw.isoweekday()
        1 # Monday
        >>> arw.span("week")
        (<Arrow [2021-04-26T00:00:00+00:00]>, <Arrow [2021-05-02T23:59:59.999999+00:00]>)
        >>> arw.span("week", week_start=4)
        (<Arrow [2021-04-22T00:00:00+00:00]>, <Arrow [2021-04-28T23:59:59.999999+00:00]>)
    
    • [NEW] Added Croatian, Latin, Latvian, Lithuanian and Malay locales.
    • [FIX] Internally standardize locales and improve locale validation. Locales should now use the ISO notation of a dash ("en-gb") rather than an underscore ("en_gb") however this change is backward compatible.
    • [FIX] Correct type checking for internal locale mapping by using _init_subclass. This now allows subclassing of locales, for example:
        >>> from arrow.locales import EnglishLocale
        >>> class Klingon(EnglishLocale):
        ...     names = ["tlh"]
        ...
        >>> from arrow import locales
        >>> locales.get_locale("tlh")
        <__main__.Klingon object at 0x7f7cd1effd30>
    
    • [FIX] Correct type checking for arrow.get(2021, 3, 9) construction.
    • [FIX] Audited all docstrings for style, typos and outdated info.
    Source code(tar.gz)
    Source code(zip)
  • 1.0.3(Mar 7, 2021)

    • [FIX] Updated internals to avoid issues when running mypy --strict.
    • [FIX] Corrections to Swedish locale.
    • [INTERNAL] Lowered required coverage limit until humanize month tests are fixed.
    Source code(tar.gz)
    Source code(zip)
  • 1.0.2(Feb 28, 2021)

  • 1.0.1(Feb 27, 2021)

  • 1.0.0(Feb 26, 2021)

    After 8 years we're pleased to announce Arrow v1.0. Thanks to the entire Python community for helping make Arrow the amazing package it is today!

    • [CHANGE] Arrow has dropped support for Python 2.7 and 3.5.
    • [CHANGE] There are multiple breaking changes with this release, please see #832 for a complete overview.
    • [CHANGE] Arrow is now following semantic versioning.
    • [CHANGE] Made humanize granularity="auto" limits more accurate to reduce strange results.
    • [NEW] Added support for Python 3.9.
    • [NEW] Added a new keyword argument "exact" to span, span_range and interval methods. This makes timespans begin at the start time given and not extend beyond the end time given, for example:
    >>> start = Arrow(2021, 2, 5, 12, 30)
    >>> end = Arrow(2021, 2, 5, 17, 15)
    >>> for r in arrow.Arrow.span_range('hour', start, end, exact=True):
        ...     print(r)
        ...
        (<Arrow [2021-02-05T12:30:00+00:00]>, <Arrow [2021-02-05T13:29:59.999999+00:00]>)
        (<Arrow [2021-02-05T13:30:00+00:00]>, <Arrow [2021-02-05T14:29:59.999999+00:00]>)
        (<Arrow [2021-02-05T14:30:00+00:00]>, <Arrow [2021-02-05T15:29:59.999999+00:00]>)
        (<Arrow [2021-02-05T15:30:00+00:00]>, <Arrow [2021-02-05T16:29:59.999999+00:00]>)
        (<Arrow [2021-02-05T16:30:00+00:00]>, <Arrow [2021-02-05T17:14:59.999999+00:00]>)
    
    • [NEW] Arrow now natively supports PEP 484-style type annotations.
    • [FIX] Fixed handling of maximum permitted timestamp on Windows systems.
    • [FIX] Corrections to French, German, Japanese and Norwegian locales.
    • [INTERNAL] Raise more appropriate errors when string parsing fails to match.
    Source code(tar.gz)
    Source code(zip)
  • 0.17.0(Oct 6, 2020)

    • [WARN] Arrow will drop support for Python 2.7 and 3.5 in the upcoming 1.0.0 release. This is the last major release to support Python 2.7 and Python 3.5.
    • [NEW] Arrow now properly handles imaginary datetimes during DST shifts. For example:
        >>> just_before = arrow.get(2013, 3, 31, 1, 55, tzinfo="Europe/Paris")
        >>> just_before.shift(minutes=+10)
        <Arrow [2013-03-31T03:05:00+02:00]>
    
        >>> before = arrow.get("2018-03-10 23:00:00", "YYYY-MM-DD HH:mm:ss", tzinfo="US/Pacific")
        >>> after = arrow.get("2018-03-11 04:00:00", "YYYY-MM-DD HH:mm:ss", tzinfo="US/Pacific")
        >>> result=[(t, t.to("utc")) for t in arrow.Arrow.range("hour", before, after)]
        >>> for r in result:
        ...     print(r)
        ...
        (<Arrow [2018-03-10T23:00:00-08:00]>, <Arrow [2018-03-11T07:00:00+00:00]>)
        (<Arrow [2018-03-11T00:00:00-08:00]>, <Arrow [2018-03-11T08:00:00+00:00]>)
        (<Arrow [2018-03-11T01:00:00-08:00]>, <Arrow [2018-03-11T09:00:00+00:00]>)
        (<Arrow [2018-03-11T03:00:00-07:00]>, <Arrow [2018-03-11T10:00:00+00:00]>)
        (<Arrow [2018-03-11T04:00:00-07:00]>, <Arrow [2018-03-11T11:00:00+00:00]>)
    
    • [NEW] Added humanize week granularity translation for Tagalog.
    • [CHANGE] Calls to the timestamp property now emit a DeprecationWarning. In a future release, timestamp will be changed to a method to align with Python's datetime module. If you would like to continue using the property, please change your code to use the int_timestamp or float_timestamp properties instead.
    • [CHANGE] Expanded and improved Catalan locale.
    • [FIX] Fixed a bug that caused Arrow.range() to incorrectly cut off ranges in certain scenarios when using month, quarter, or year endings.
    • [FIX] Fixed a bug that caused day of week token parsing to be case sensitive.
    • [INTERNAL] A number of functions were reordered in arrow.py for better organization and grouping of related methods. This change will have no impact on usage.
    • [INTERNAL] A minimum tox version is now enforced for compatibility reasons. Contributors must use tox >3.18.0 going forward.
    Source code(tar.gz)
    Source code(zip)
  • 0.16.0(Aug 23, 2020)

    • [WARN] Arrow will drop support for Python 2.7 and 3.5 in the 1.0.0 release in late September. The 0.16.x and 0.17.x releases are the last to support Python 2.7 and 3.5.
    • [NEW] Implemented PEP 495 to handle ambiguous datetimes. This is achieved by the addition of the fold attribute for Arrow objects. For example:
        >>> before = Arrow(2017, 10, 29, 2, 0, tzinfo='Europe/Stockholm')
        <Arrow [2017-10-29T02:00:00+02:00]>
        >>> before.fold
        0
        >>> before.ambiguous
        True
        >>> after = Arrow(2017, 10, 29, 2, 0, tzinfo='Europe/Stockholm', fold=1)
        <Arrow [2017-10-29T02:00:00+01:00]>
        >>> after = before.replace(fold=1)
        <Arrow [2017-10-29T02:00:00+01:00]>
    
    • [NEW] Added normalize_whitespace flag to arrow.get. This is useful for parsing log files and/or any files that may contain inconsistent spacing. For example:
        >>> arrow.get("Jun 1 2005     1:33PM", "MMM D YYYY H:mmA", normalize_whitespace=True)
        <Arrow [2005-06-01T13:33:00+00:00]>
        >>> arrow.get("2013-036 \t  04:05:06Z", normalize_whitespace=True)
        <Arrow [2013-02-05T04:05:06+00:00]>
    
    Source code(tar.gz)
    Source code(zip)
  • 0.15.8(Jul 24, 2020)

    • [WARN] arrow will drop support for Python 2.7 and 3.5 in the 1.0.0 release in late September. The 0.15.x and 0.16.x releases are the last to support Python 2.7 and 3.5.
    • [NEW] Added humanize week granularity translation for Czech.
    • [FIX] arrow.get will now pick sane defaults when weekdays are passed with particular token combinations, see #446
    • [INTERNAL] Moved arrow to an organization. The repo can now be found here.
    • [INTERNAL] Started issuing deprecation warnings for Python 2.7 and 3.5.
    • [INTERNAL] Added Python 3.9 to CI pipeline.
    Source code(tar.gz)
    Source code(zip)
  • 0.15.7(Jun 19, 2020)

    • [NEW] Added a number of built-in format strings. See the docs for a complete list of supported formats. For example:
        >>> arw = arrow.utcnow()
        >>> arw.format(arrow.FORMAT_COOKIE)
        'Wednesday, 27-May-2020 10:30:35 UTC'
    
    • [NEW] Arrow is now fully compatible with Python 3.9 and PyPy3.
    • [NEW] Added Makefile, tox.ini, and requirements.txt files to the distribution bundle.
    • [NEW] Added French Canadian and Swahili locales.
    • [NEW] Added humanize week granularity translation for Hebrew, Greek, Macedonian, Swedish, Slovak.
    • [FIX] ms and μs timestamps are now normalized in arrow.get() , arrow.fromtimestamp(), and arrow.utcfromtimestamp(). For example:
        >>> ts = 1591161115194556
        >>> arw = arrow.get(ts)
        <Arrow [2020-06-03T05:11:55.194556+00:00]>
        >>> arw.timestamp
        1591161115
    
    • [FIX] Refactored and updated Macedonian, Hebrew, Korean, and Portuguese locales.
    Source code(tar.gz)
    Source code(zip)
  • 0.15.6(May 3, 2020)

    • [NEW] Added support for parsing and formatting ISO 8601 week dates via a new token W, for example:
    >>> arrow.get("2013-W29-6", "W")
    <Arrow [2013-07-20T00:00:00+00:00]>
    >>> utc=arrow.utcnow()
    >>> utc
    <Arrow [2020-01-23T18:37:55.417624+00:00]>
    >>> utc.format("W")
    '2020-W04-4'
    
    • [NEW] Formatting with x token (microseconds) is now possible, for example:
    >>> dt = arrow.utcnow()
    >>> dt.format("x")
    '1585669870688329'
    >>> dt.format("X")
    '1585669870'
    
    • [NEW] Added humanize week granularity translation for German, Italian, Polish & Taiwanese locales.
    • [FIX] Consolidated and simplified German locales.
    • [INTERNAL] Moved testing suite from nosetest/Chai to pytest/pytest-mock.
    • [INTERNAL] Converted xunit-style setup and teardown functions in tests to pytest fixtures.
    • [INTERNAL] Setup Github Actions for CI alongside Travis.
    • [INTERNAL] Help support Arrow's future development by donating to the project on Open Collective.
    Source code(tar.gz)
    Source code(zip)
  • 0.15.5(Jan 3, 2020)

    • [WARN] Python 2 reached EOL on 2020-01-01. arrow will drop support for Python 2 in a future release to be decided (see #739).
    • [NEW] Added bounds parameter to span_range, interval and span methods. This allows you to include or exclude the start and end values.
    • [NEW] arrow.get() can now create arrow objects from a timestamp with a timezone, for example:
    >>> arrow.get(1367900664, tzinfo=tz.gettz('US/Pacific'))
    <Arrow [2013-05-06T21:24:24-07:00]>
    
    • [NEW] humanize can now combine multiple levels of granularity, for example:
    >>> later140 = arrow.utcnow().shift(seconds=+8400)
    >>> later140.humanize(granularity="minute")
    'in 139 minutes'
    >>> later140.humanize(granularity=["hour", "minute"])
    'in 2 hours and 19 minutes'
    
    • [NEW] Added Hong Kong locale (zh_hk).
    • [NEW] Added humanize week granularity translation for Dutch.
    • [NEW] Numbers are now displayed when using the seconds granularity in humanize.
    • [CHANGE] range now supports both the singular and plural forms of the frames argument (e.g. day and days).
    • [FIX] Improved parsing of strings that contain punctuation.
    • [FIX] Improved behaviour of humanize when singular seconds are involved.
    Source code(tar.gz)
    Source code(zip)
  • 0.15.4(Nov 3, 2019)

  • 0.15.3(Nov 2, 2019)

    • [NEW] factory.get() can now create arrow objects from a ISO calendar tuple, for example:
        >>> arrow.get((2013, 18, 7))
        <Arrow [2013-05-05T00:00:00+00:00]>
    
    • [NEW] Added a new token x to allow parsing of integer timestamps with milliseconds and microseconds.
    • [NEW] Formatting now supports escaping of characters using the same syntax as parsing, for example:
        >>> arw = arrow.now()
        >>> fmt = "YYYY-MM-DD h [h] m"
        >>> arw.format(fmt)
        '2019-11-02 3 h 32'
    
    • [NEW] Added humanize week granularity translations for Chinese, Spanish and Vietnamese.
    • [CHANGE] Added ParserError to module exports.
    • [FIX] Added support for midnight at end of day. See #703 for details.
    • [INTERNAL] Created Travis build for macOS.
    • [INTERNAL] Test parsing and formatting against full timezone database.
    Source code(tar.gz)
    Source code(zip)
  • 0.15.2(Sep 14, 2019)

    • [NEW] Added humanize week granularity translations for Portuguese and Brazilian Portuguese.
    • [NEW] Embedded changelog within docs and added release dates to versions.
    • [FIX] Fixed a bug that caused test failures on Windows only, see #668 for details.
    Source code(tar.gz)
    Source code(zip)
  • 0.15.1(Sep 10, 2019)

    • [FIX] Fixed a bug that caused Arrow to fail when passed a negative timestamp string.
    • [FIX] Fixed a bug that caused Arrow to fail when passed a datetime object with tzinfo of type StaticTzInfo.
    Source code(tar.gz)
    Source code(zip)
  • 0.15.0(Sep 8, 2019)

    • [NEW] Added support for DDD and DDDD ordinal date tokens. The following functionality is now possible: arrow.get("1998-045"), arrow.get("1998-45", "YYYY-DDD"), arrow.get("1998-045", "YYYY-DDDD").
    • [NEW] ISO 8601 basic format for dates and times is now supported (e.g. YYYYMMDDTHHmmssZ).
    • [NEW] Added humanize week granularity translations for French, Russian and Swiss German locales.
    • [CHANGE] Timestamps of type str are no longer supported without a format string in the arrow.get() method. This change was made to support the ISO 8601 basic format and to address bugs such as #447.
    # will NOT work in v0.15.0
    arrow.get("1565358758")
    arrow.get("1565358758.123413")
    
    # will work in v0.15.0
    arrow.get("1565358758", "X")
    arrow.get("1565358758.123413", "X")
    arrow.get(1565358758)
    arrow.get(1565358758.123413)
    
    • [CHANGE] When a meridian token (a|A) is passed and no meridians are available for the specified locale (e.g. unsupported or untranslated) a ParserError is raised.
    • [CHANGE] The timestamp token (X) will now match float timestamps of type str: arrow.get(“1565358758.123415”, “X”).
    • [CHANGE] Strings with leading and/or trailing whitespace will no longer be parsed without a format string. Please see the docs for ways to handle this.
    • [FIX] The timestamp token (X) will now only match on strings that strictly contain integers and floats, preventing incorrect matches.
    • [FIX] Most instances of arrow.get() returning an incorrect Arrow object from a partial parsing match have been eliminated. The following issue have been addressed: #91, #196, #396, #434, #447, #456, #519, #538, #560.
    Source code(tar.gz)
    Source code(zip)
  • 0.14.7(Sep 4, 2019)

    • [CHANGE] ArrowParseWarning will no longer be printed on every call to arrow.get() with a datetime string. The purpose of the warning was to start a conversation about the upcoming 0.15.0 changes and we appreciate all the feedback that the community has given us!
    Source code(tar.gz)
    Source code(zip)
  • 0.14.6(Aug 27, 2019)

    • [NEW] Added support for week granularity in Arrow.humanize(). For example, arrow.utcnow().shift(weeks=-1).humanize(granularity="week") outputs "a week ago". This change introduced two new untranslated words, week and weeks, to all locale dictionaries, so locale contributions are welcome!
    • [NEW] Fully translated the Brazilian Portugese locale.
    • [CHANGE] Updated the Macedonian locale to inherit from a Slavic base.
    • [FIX] Fixed a bug that caused arrow.get() to ignore tzinfo arguments of type string (e.g. arrow.get(tzinfo="Europe/Paris")).
    • [FIX] Fixed a bug that occurred when arrow.Arrow() was instantiated with a pytz tzinfo object.
    • [FIX] Fixed a bug that caused Arrow to fail when passed a sub-second token, that when rounded, had a value greater than 999999 (e.g. arrow.get("2015-01-12T01:13:15.9999995")). Arrow should now accurately propagate the rounding for large sub-second tokens.
    Source code(tar.gz)
    Source code(zip)
  • 0.14.5(Aug 9, 2019)

    • Added Afrikaans locale.
    • Removed deprecated replace shift functionality.
    • Fixed bug that occurred when factory.get() was passed a locale kwarg. (#630 )
    Source code(tar.gz)
    Source code(zip)
  • 0.14.4(Jul 30, 2019)

    • Fixed a regression in 0.14.3 that prevented a tzinfo argument of type string to be passed to the get() function. Functionality such as arrow.get("2019072807", "YYYYMMDDHH", tzinfo="UTC") should work as normal again.
    • Moved backports.functools_lru_cache dependency from extra_requires to install_requires for Python 2.7 installs to fix #495.
    Source code(tar.gz)
    Source code(zip)
  • 0.14.3(Jul 28, 2019)

    • Added full support for Python 3.8.
    • Added warnings for upcoming factory.get() parsing changes in 0.15.0. Please see https://github.com/crsmithdev/arrow/issues/612 for full details.
    • Extensive refactor and update of documentation.
    • factory.get() can now construct from kwargs.
    • Added meridians to Spanish Locale.
    Source code(tar.gz)
    Source code(zip)
  • 0.14.2(Jun 6, 2019)

  • 0.14.1(Jun 6, 2019)

  • 0.14.0(Jun 6, 2019)

    • Add provisional support for Python 3.8.
    • Remove support for EOL Python 3.4.
    • Update setup.py with modern Python standards.
    • Upgrade dependencies to latest versions.
    • Enable flake8 and black on travis builds.
    • Reformat code using black and isort.
    Source code(tar.gz)
    Source code(zip)
  • 0.13.2(May 30, 2019)

    • Add is_between method.
    • Improved humanize behaviour for near zero durations.
    • Correct humanize behaviour with future days.
    • Documentation updates.
    • Improvements to German Locale.
    Source code(tar.gz)
    Source code(zip)
  • 0.13.1(Feb 17, 2019)

    • Add support for Python 3.7.
    • Remove deprecation decorators for Arrow.range(), Arrow.span_range() and Arrow.interval(). All now return generators, wrap with list() to get old behavior.
    Source code(tar.gz)
    Source code(zip)
A Python library for dealing with dates

moment A Python library for dealing with dates/times. Inspired by Moment.js and Kenneth Reitz's Requests library. Ideas were also taken from the Times

Zach Williams 709 Dec 9, 2022
Friendly Python Dates

When.py: Friendly Dates and Times Production: Development: User-friendly functions to help perform common date and time actions. Usage To get the syst

Andy Dirnberger 191 Oct 14, 2022
python parser for human readable dates

Python parser for human readable dates Key Features • How To Use • Installation • Common use cases • You may also like... • License Key Features Suppo

Scrapinghub 2.2k Jan 8, 2023
Useful extensions to the standard Python datetime features

dateutil - powerful extensions to datetime The dateutil module provides powerful extensions to the standard datetime module, available in Python. Inst

null 2k Dec 29, 2022
Python datetimes made easy

Pendulum Python datetimes made easy. Supports Python 2.7 and 3.4+. >>> import pendulum >>> now_in_paris = pendulum.now('Europe/Paris') >>> now_in_par

Sébastien Eustace 5.3k Jan 6, 2023
PyTime is an easy-use Python module which aims to operate date/time/datetime by string.

PyTime PyTime is an easy-use Python module which aims to operate date/time/datetime by string. PyTime allows you using nonregular datetime string to g

Sinux 148 Dec 9, 2022
pytz Python historical timezone library and database

pytz Brings the IANA tz database into Python. This library allows accurate and cross platform timezone calculations. pytz contains generated code, and

Stub 236 Jan 3, 2023
Generate and work with holidays in Python

python-holidays A fast, efficient Python library for generating country, province and state specific sets of holidays on the fly. It aims to make dete

Maurizio Montel 881 Dec 29, 2022
A Python module that tries to figure out what your local timezone is

tzlocal This Python module returns a tzinfo object with the local timezone information under Unix and Windows. It requires either Python 3.9+ or the b

Lennart Regebro 159 Dec 16, 2022
A simple in-process python scheduler library, designed to be integrated seamlessly with the `datetime` standard library.

scheduler A simple in-process python scheduler library, designed to be integrated seamlessly with the datetime standard library. Due to the support of

null 30 Dec 30, 2022
darts is a Python library for easy manipulation and forecasting of time series.

A python library for easy manipulation and forecasting of time series.

Unit8 5.2k Jan 1, 2023
Make Python datetime formatting human readable

Make Python datetime formatting human readable

James Timmins 0 Oct 3, 2021
A simple digital clock made with the help of python

Digital-Clock ⏰ Description ?? ✔️ A simple digital clock made with the help of python. The code is easy to understand and implement. With this reposit

Mohit 0 Dec 10, 2021
A datetime parser in Python by Ari24-cb24 and NekoFantic

datetimeparser A datetime parser in Python by Ari24-cb24 and NekoFantic V 1.0 Erinnerung für den Parser Auf falsche Eingaben überprüfen Liste an Event

AriDevelopment 13 Dec 30, 2022
A Python 3 library for parsing human-written times and dates

Chronyk A small Python 3 library containing some handy tools for handling time, especially when it comes to interfacing with those pesky humans. Featu

Felix Wiegand 339 Dec 19, 2022
Formatting of dates and times in Flask templates using moment.js.

Flask-Moment This extension enhances Jinja2 templates with formatting of dates and times using moment.js. Quick Start Step 1: Initialize the extension

Miguel Grinberg 358 Nov 28, 2022
Formatting of dates and times in Flask templates using moment.js.

Flask-Moment This extension enhances Jinja2 templates with formatting of dates and times using moment.js. Quick Start Step 1: Initialize the extension

Miguel Grinberg 318 Feb 17, 2021
Formatting of dates and times in Flask templates using moment.js.

Flask-Moment This extension enhances Jinja2 templates with formatting of dates and times using moment.js. Quick Start Step 1: Initialize the extension

Miguel Grinberg 358 Nov 28, 2022
Chronocalc - Calculates the dates and times when the sun or moon is in a given position in the sky

Chronocalc I wrote this script after I was busy updating my article on chronoloc

null 16 Dec 13, 2022
A Python library for dealing with dates

moment A Python library for dealing with dates/times. Inspired by Moment.js and Kenneth Reitz's Requests library. Ideas were also taken from the Times

Zach Williams 709 Dec 9, 2022