Skip to content

Commit

Permalink
fixed a doc anchor
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Sep 29, 2012
1 parent 73ab8ff commit 2f7b43b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
13 changes: 7 additions & 6 deletions doc/filters/date.rst
Expand Up @@ -53,13 +53,14 @@ The default timezone can also be set globally by calling ``setTimezone()``:
$twig = new Twig_Environment($loader);
$twig->getExtension('core')->setTimezone('Europe/Paris');
.. _`strtotime`: http://www.php.net/strtotime
.. _`DateTime`: http://www.php.net/DateTime
.. _`DateInterval`: http://www.php.net/DateInterval

If the value passed to the ``date`` filter is null, it will return the current date by default.
If an empty string is desired instead of the current date, use a ternary operator:
If the value passed to the ``date`` filter is ``null``, it will return the
current date by default. If an empty string is desired instead of the current
date, use a ternary operator:

.. code-block:: jinja
{{ post.published_at is empty ? "" : post.published_at|date("m/d/Y") }}
.. _`strtotime`: http://www.php.net/strtotime
.. _`DateTime`: http://www.php.net/DateTime
.. _`DateInterval`: http://www.php.net/DateInterval
6 changes: 3 additions & 3 deletions doc/filters/date_modify.rst
Expand Up @@ -10,9 +10,9 @@ The ``date_modify`` filter modifies a date with a given modifier string:
{{ post.published_at|date_modify("+1 day")|date("m/d/Y") }}
The ``date_modify`` filter accepts strings (it must be in a format supported by the
`strtotime`_ function) or `DateTime`_ instances. You can easily combine it with the `date`_
filter for formatting.
The ``date_modify`` filter accepts strings (it must be in a format supported
by the `strtotime`_ function) or `DateTime`_ instances. You can easily combine
it with the :doc:`date </filters/date>` filter for formatting.

.. _`strtotime`: http://www.php.net/strtotime
.. _`DateTime`: http://www.php.net/DateTime

0 comments on commit 2f7b43b

Please sign in to comment.