-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix DateFormatters.parseMillis when no timezone is given (#39112)
The parseMillis method was able to work on formats without timezones by falling back to UTC. The Java Date Formatter did not support this, as the calling code was using the `Instant.from` java time API. This switches over to an internal method which adds UTC as a timezone. Closes #39067
- Loading branch information
Showing
3 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
rest-api-spec/src/main/resources/rest-api-spec/test/index/70_bwc_date.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
"Index java 8 date without timezone": | ||
|
||
- skip: | ||
version: " - 6.6.99" | ||
reason: bwc formatters were introduced in Elasticsearch 6.7 | ||
|
||
- do: | ||
indices.create: | ||
index: test_index | ||
body: | ||
settings: | ||
number_of_shards: 1 | ||
mappings: | ||
doc: | ||
properties: | ||
date_field: | ||
type: date | ||
format: "8yyyy-MM-dd HH:mm:ss" | ||
- do: | ||
bulk: | ||
refresh: true | ||
body: | ||
- '{"index": {"_index": "test_index", "_type": "doc", "_id": "1"}}' | ||
- '{"date_field": "2018-02-18 17:47:17"}' | ||
|
||
- match: { errors: false } | ||
|
||
- do: | ||
get: | ||
index: test_index | ||
type: doc | ||
id: 1 | ||
|
||
- match: { _index: test_index } | ||
- match: { _type: doc } | ||
- match: { _id: "1"} | ||
- match: { _version: 1} | ||
- match: { _source: { "date_field": "2018-02-18 17:47:17" }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters