mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixed #31948 -- Added tzinfo parameter to TruncDate() and TruncTime().
This commit is contained in:
parent
76e0151ea0
commit
9d5d865fd6
5 changed files with 28 additions and 4 deletions
|
@ -623,20 +623,28 @@ that deal with date-parts can be used with ``DateField``::
|
|||
``DateTimeField`` truncation
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. class:: TruncDate(expression, **extra)
|
||||
.. class:: TruncDate(expression, tzinfo=None, **extra)
|
||||
|
||||
.. attribute:: lookup_name = 'date'
|
||||
.. attribute:: output_field = DateField()
|
||||
|
||||
.. versionchanged:: 3.2
|
||||
|
||||
The ``tzinfo`` parameter was added.
|
||||
|
||||
``TruncDate`` casts ``expression`` to a date rather than using the built-in SQL
|
||||
truncate function. It's also registered as a transform on ``DateTimeField`` as
|
||||
``__date``.
|
||||
|
||||
.. class:: TruncTime(expression, **extra)
|
||||
.. class:: TruncTime(expression, tzinfo=None, **extra)
|
||||
|
||||
.. attribute:: lookup_name = 'time'
|
||||
.. attribute:: output_field = TimeField()
|
||||
|
||||
.. versionchanged:: 3.2
|
||||
|
||||
The ``tzinfo`` parameter was added.
|
||||
|
||||
``TruncTime`` casts ``expression`` to a time rather than using the built-in SQL
|
||||
truncate function. It's also registered as a transform on ``DateTimeField`` as
|
||||
``__time``.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue