mirror of https://github.com/apache/superset.git
[SIP-15] Making client time use UTC as the local time (#8450)
* [fix] Making client time UTC * Update UPDATING.md
This commit is contained in:
parent
a757b43164
commit
f7f0be502d
|
@ -23,6 +23,9 @@ assists people when migrating to a new version.
|
|||
|
||||
## Next Version
|
||||
|
||||
* [8450](https://github.com/apache/incubator-superset/pull/8450): The time ranger picker
|
||||
now uses UTC for the tooltips and default placeholder timestamps (sans timezone).
|
||||
|
||||
* [8370](https://github.com/apache/incubator-superset/pull/8370): Deprecates
|
||||
the `HTTP_HEADERS` variable in favor of `DEFAULT_HTTP_HEADERS` and
|
||||
`OVERRIDE_HTTP_HEADERS`. To retain the same behavior you should use
|
||||
|
|
|
@ -67,8 +67,15 @@ const COMMON_TIME_FRAMES = [
|
|||
const TIME_GRAIN_OPTIONS = ['seconds', 'minutes', 'hours', 'days', 'weeks', 'months', 'years'];
|
||||
|
||||
const MOMENT_FORMAT = 'YYYY-MM-DD[T]HH:mm:ss';
|
||||
const DEFAULT_SINCE = moment().startOf('day').subtract(7, 'days').format(MOMENT_FORMAT);
|
||||
const DEFAULT_UNTIL = moment().startOf('day').format(MOMENT_FORMAT);
|
||||
const DEFAULT_SINCE = moment()
|
||||
.utc()
|
||||
.startOf('day')
|
||||
.subtract(7, 'days')
|
||||
.format(MOMENT_FORMAT);
|
||||
const DEFAULT_UNTIL = moment()
|
||||
.utc()
|
||||
.startOf('day')
|
||||
.format(MOMENT_FORMAT);
|
||||
const SEPARATOR = ' : ';
|
||||
const FREEFORM_TOOLTIP = t(
|
||||
'Superset supports smart date parsing. Strings like `last sunday` or ' +
|
||||
|
@ -116,8 +123,12 @@ function getStateFromCommonTimeFrame(value) {
|
|||
tab: TABS.DEFAULTS,
|
||||
type: TYPES.DEFAULTS,
|
||||
common: value,
|
||||
since: moment().startOf('day').subtract(1, units).format(MOMENT_FORMAT),
|
||||
until: moment().startOf('day').format(MOMENT_FORMAT),
|
||||
since: moment()
|
||||
.utc()
|
||||
.startOf('day')
|
||||
.subtract(1, units)
|
||||
.format(MOMENT_FORMAT),
|
||||
until: moment().utc().startOf('day').format(MOMENT_FORMAT),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -126,13 +137,15 @@ function getStateFromCustomRange(value) {
|
|||
let since;
|
||||
let until;
|
||||
if (rel === RELATIVE_TIME_OPTIONS.LAST) {
|
||||
until = moment().startOf('day').format(MOMENT_FORMAT);
|
||||
until = moment().utc().startOf('day').format(MOMENT_FORMAT);
|
||||
since = moment()
|
||||
.utc()
|
||||
.startOf('day')
|
||||
.subtract(num, grain)
|
||||
.format(MOMENT_FORMAT);
|
||||
} else {
|
||||
until = moment()
|
||||
.utc()
|
||||
.startOf('day')
|
||||
.add(num, grain)
|
||||
.format(MOMENT_FORMAT);
|
||||
|
|
|
@ -951,6 +951,14 @@ export const controls = {
|
|||
freeForm: true,
|
||||
label: t('Time range'),
|
||||
default: t('Last week'),
|
||||
description: t(
|
||||
'The time range for the visualization. All relative times, e.g. "Last month", ' +
|
||||
'"Last 7 days", "now", etc. are evaluated on the server using the server\'s ' +
|
||||
'local time (sans timezone). All tooltips and placeholder times are expressed ' +
|
||||
'in UTC (sans timezone). The timestamps are then evaluated by the database ' +
|
||||
'using the engine\'s local timezone. Note one can explicitly set the timezone ' +
|
||||
'per the ISO 8601 format if specifying either the start and/or end time.',
|
||||
),
|
||||
},
|
||||
|
||||
max_bubble_size: {
|
||||
|
|
Loading…
Reference in New Issue