-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Data Plugin] Allow server-side date formatters to accept custom timezone #70668
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
Changes from all commits
6aacfbd
6428455
1789afc
76e2c30
5aa2d80
206aed6
d42275c
231f793
1e1d3c5
1bebcc8
736e9ee
fc9ff7b
1b6e9e8
54fa2fe
34df331
4e5eebd
ed749eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,6 @@ import { | |
| BoolFormat, | ||
| BytesFormat, | ||
| ColorFormat, | ||
| DateNanosFormat, | ||
| DurationFormat, | ||
| IpFormat, | ||
| NumberFormat, | ||
|
|
@@ -40,7 +39,6 @@ export const baseFormatters: FieldFormatInstanceType[] = [ | |
| BoolFormat, | ||
| BytesFormat, | ||
| ColorFormat, | ||
| DateNanosFormat, | ||
|
||
| DurationFormat, | ||
| IpFormat, | ||
| NumberFormat, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -180,10 +180,18 @@ export class FieldFormatsRegistry { | |
| * @param {ES_FIELD_TYPES[]} esTypes | ||
| * @return {FieldFormat} | ||
| */ | ||
| getDefaultInstancePlain(fieldType: KBN_FIELD_TYPES, esTypes?: ES_FIELD_TYPES[]): FieldFormat { | ||
| getDefaultInstancePlain( | ||
| fieldType: KBN_FIELD_TYPES, | ||
| esTypes?: ES_FIELD_TYPES[], | ||
| params: Record<string, any> = {} | ||
| ): FieldFormat { | ||
| const conf = this.getDefaultConfig(fieldType, esTypes); | ||
| const instanceParams = { | ||
| ...conf.params, | ||
| ...params, | ||
| }; | ||
|
|
||
| return this.getInstance(conf.id, conf.params); | ||
| return this.getInstance(conf.id, instanceParams); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This allows timezone to be passed from the browser and formatted correctly on the server |
||
| } | ||
| /** | ||
| * Returns a cache key built by the given variables for caching in memoized | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| /* | ||
| * Licensed to Elasticsearch B.V. under one or more contributor | ||
| * license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright | ||
| * ownership. Elasticsearch B.V. licenses this file to you under | ||
| * the Apache License, Version 2.0 (the "License"); you may | ||
| * not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| export { DateNanosFormat } from '../../../common/field_formats/converters/date_nanos_shared'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,3 +18,4 @@ | |
| */ | ||
|
|
||
| export { DateFormat } from './date'; | ||
| export { DateNanosFormat } from './date_nanos'; | ||
Uh oh!
There was an error while loading. Please reload this page.