django-haystack / django-haystack/django-haystack
Haystack date indexes are not storing timezone information
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3.7k
- Forks
- 1.3k
- Avg merge
- 3h 18m
- Merged PRs (30d)
- 3
Description
- Tested with the latest Haystack release
- Tested with the current Haystack master branch
Expected behaviour
'published' should have timezone included and for UTC should get something like: 2018-02-17T02:14:53.343690Z
Actual behaviour
But what I get is: 2018-02-17T02:14:53 from haystack. When I query my DB model, I get the correct value with timezone information.
Steps to reproduce the behaviour
published = indexes.DatetimeField(model_attr='publish_date')
USE_TZ=True
Configuration
- Operating system version: ubuntu:14.04
- Search engine version: ES 2.0.0
- Python version: 2.7.6
- Django version: 1.8
- Haystack version: latest version
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the indexes.DatetimeField case with USE_TZ=True and Elasticsearch 2.0, comparing the indexed date with the Django model value. Then inspect Haystack's DatetimeField and Elasticsearch backend handling of datetime serialization. Done means the indexed published value retains timezone information, including the expected UTC form.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- django, elasticsearch, python
- Domain
- search
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100