tortoise / tortoise-orm

Familiar asyncio ORM for python, built with relations in mind
https://tortoise.github.io
Apache License 2.0
4.58k stars 378 forks source link

Can't filter DateField by YEAR #1486

Open mrkotee opened 1 year ago

mrkotee commented 1 year ago

Have iso8601.iso8601.ParseError when try to filter DateField by YEAR.

To Reproduce


class SomeModel(MODEL):
    start_date = fields.DateField()
    end_date = fields.DateField()

await SomeModel.filter(start_date__year=2023)

Look like to_db_value must not validate value if used date filters

p.s. in DateTimeField all works correctly

tortoise-orm version 0.19.3 and 0.20.0