-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
date format parsed from query to builder defaults to current date with fixed format #7
Comments
…urrent date with fixed format
What do you mean by this? I hesitate to add something like |
With this fix, a format field is added next to a date, for instance:
Hence the builder knows the format to parse a string to a date. MomentJS/Angular-MomentJS appears to be the solution for the job. Without this fix, the format is hard coded and any date field in "stored" queries must follow this format so that the query can be parsed by the builder. Also without the fix, a date in a query defaults to the current date when parsed through the builder. I have created a search application that uses the builder in this way with a demo. I hope this helps to illustrate my understanding on how to use your builder. |
Just a note: if we add 'format' key to the rule, like this:
elasticsearch will return an error:
I suggest to use one format only 'yyyy-MM-dd'T'HH:mm:ssZ' and then use another datepicker library that include timepicker e.g. angular-bootstrap-datetimepicker |
Elastic search understands multiple date formats so it seems interesting to have this feature in the builder. Also setting the time is not always relevant in a range search so date only format are useful. But I agree that when time is required, it would be nice to have a timepicker. I suggest ui.boostrap.timepicker. This should be a request for a new feature in a separate issue though. |
If it breaks elasticsearch as is, I'm not interested in having it. This is first and foremost an Elasticsearch query builder. |
Thoughts about doing something like: 'test.date': { type: 'date', format: 'YYYY-mm-dd' }, This sounds right to me. Elasticsearch supports multiple date formats, but each field in ES should only be standardized into a single format. I think we should rewrite it to be like this. |
Or perhaps passing your own |
@dncrews
When parsed into the builder, date fields from a query default to the current date with fixed format (calendar default format). Only some ISO formats are recognized
The text was updated successfully, but these errors were encountered: