Skip to content

Commit 8a6c8cd

Browse files
committed
Simplify the docs a bit for relative dates
1 parent 26940b6 commit 8a6c8cd

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

beets/dbcore/query.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -577,20 +577,19 @@ def __init__(self, date, precision):
577577
@classmethod
578578
def parse(cls, string):
579579
"""Parse a date and return a `Period` object or `None` if the
580-
string is empty.
581-
Depending on the string, the date can be absolute or
582-
relative.
583-
An absolute date has to be like one of the date_formats '%Y' or '%Y-%m'
584-
or '%Y-%m-%d'
585-
A relative date consists of three parts:
586-
- a ``+`` or ``-`` sign is optional and defaults to ``+``. The ``+``
587-
sign will add a time quantity to the current date while the ``-`` sign
588-
will do the opposite
589-
- a number follows and indicates the amount to add or substract
590-
- a final letter ends and represents the amount in either days, weeks,
591-
months or years (``d``, ``w``, ``m`` or ``y``)
592-
Please note that this relative calculation makes the assumption of 30
593-
days per month and 365 days per year.
580+
string is empty, or raise an InvalidQueryArgumentValueError if
581+
the string cannot be parsed to a date.
582+
583+
The date may be absolute or relative. Absolute dates look like
584+
`YYYY`, or `YYYY-MM-DD`, or `YYYY-MM-DD HH:MM:SS`, etc. Relative
585+
dates have three parts:
586+
587+
- Optionally, a ``+`` or ``-`` sign indicating the future or the
588+
past. The default is the future.
589+
- A number: how much to add or subtract.
590+
- A letter indicating the unit: days, weeks, months or years
591+
(``d``, ``w``, ``m`` or ``y``). A "month" is exactly 30 days
592+
and a "year" is exactly 365 days.
594593
"""
595594

596595
def find_date_and_format(string):

0 commit comments

Comments
 (0)