On Monday 07 March 2016 12:20:59 Josh Smeaton wrote:
> FYI I'm implementing date_trunc based transforms in this
> patch:
https://github.com/django/django/pull/6243
>
> Since the transform names "__month" "__year" etc are already taken by the
> Extract based transforms I've not yet implemented a lookup_name so that
> they can be used on the left hand side of filters
> (.filter(created__monthtrunc=..). If there is a decent proposal for trunc
> based lookup names, it'll be very easy to add them on.
>
I find the name "trunc" is SQL-technical and opaque; and there's a need to
explain the difference between, say, the extract transform (where 'year' gives
an integer) and the trunc transforms which all give dates and datetimes,
corresponding to the start of the named period.
So, I suggest we use "start".
birthdate__yearstart (midnight, january first on the birth date's year)
event__daystart (midnight before the event)
etc.