diff --git a/manual/template_lang.rst b/manual/template_lang.rst index db6272a2ed..4d079a866c 100644 --- a/manual/template_lang.rst +++ b/manual/template_lang.rst @@ -398,7 +398,7 @@ In `GPM` the functions described in `Single Function Mode` all require an additi * ``w``: add ``v`` weeks to ``date`` * ``y``: add ``v`` years to ``date``, where a year is 365 days. - Example: ``'1s3d-1m'`` will add 1 second, add 3 days, and subtract 1 month from ``date``. + Example: ``'1s3d-1m'`` will add 1 second, add 3 days, and subtract 1 minute from ``date``. * ``days_between(date1, date2)`` -- return the number of days between ``date1`` and ``date2``. The number is positive if ``date1`` is greater than ``date2``, otherwise negative. If either ``date1`` or ``date2`` are not dates, the function returns the empty string. * ``divide(x, y)`` -- returns ``x / y``. Throws an exception if either ``x`` or ``y`` are not numbers. This function can usually be replaced by the ``/`` operator. * ``eval(string)`` -- evaluates the string as a program, passing the local variables. This permits using the template processor to construct complex results from local variables. In :ref:`Template Program Mode `, because the `{` and `}` characters are interpreted before the template is evaluated you must use `[[` for the `{` character and `]]` for the ``}`` character. They are converted automatically. Note also that prefixes and suffixes (the `|prefix|suffix` syntax) cannot be used in the argument to this function when using :ref:`Template Program Mode `. diff --git a/src/calibre/utils/formatter_functions.py b/src/calibre/utils/formatter_functions.py index 646b979a03..c6d98d5afb 100644 --- a/src/calibre/utils/formatter_functions.py +++ b/src/calibre/utils/formatter_functions.py @@ -1629,7 +1629,7 @@ class BuiltinDateArithmetic(BuiltinFormatterFunction): "w: add 'v' weeks to 'date' " "y: add 'v' years to 'date', where a year is 365 days. " "Example: '1s3d-1m' will add 1 second, add 3 days, and subtract 1 " - "month from 'date'.") + "minute from 'date'.") calc_ops = { 's': lambda v: timedelta(seconds=v), @@ -1638,7 +1638,7 @@ class BuiltinDateArithmetic(BuiltinFormatterFunction): 'd': lambda v: timedelta(days=v), 'w': lambda v: timedelta(weeks=v), 'y': lambda v: timedelta(days=v * 365), - } + } def evaluate(self, formatter, kwargs, mi, locals, date, calc_spec, fmt=None): try: