Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions airflow-core/docs/authoring-and-scheduling/timezone.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ The users' selected timezone is stored in LocalStorage so is a per-browser setti

.. note::

If you have configured your Airflow install to use a different default timezone and want the UI to use this same timezone, set ``default_ui_timezone`` in the ``[webserver]`` section to either an empty string, or the same value.

(It currently defaults to UTC to keep behaviour of the UI consistent by default between point-releases.)
The UI will use the system timezone by default. Users can change their timezone preferences through the UI's timezone selector.

Concepts
--------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class ConfigResponse(BaseModel):
navbar_logo_text_color: str
page_size: int
auto_refresh_interval: int
default_ui_timezone: str
hide_paused_dags_by_default: bool
instance_name: str
instance_name_has_markup: bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8193,9 +8193,6 @@ components:
auto_refresh_interval:
type: integer
title: Auto Refresh Interval
default_ui_timezone:
type: string
title: Default Ui Timezone
hide_paused_dags_by_default:
type: boolean
title: Hide Paused Dags By Default
Expand Down Expand Up @@ -8240,7 +8237,6 @@ components:
- navbar_logo_text_color
- page_size
- auto_refresh_interval
- default_ui_timezone
- hide_paused_dags_by_default
- instance_name
- instance_name_has_markup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"navbar_color",
"page_size",
"auto_refresh_interval",
"default_ui_timezone",
"hide_paused_dags_by_default",
"warn_deployment_exposure",
"default_wrap",
Expand Down
4 changes: 4 additions & 0 deletions airflow-core/src/airflow/cli/commands/config_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,10 @@ def message(self) -> str | None:
config=ConfigParameter("webserver", "max_form_parts"),
was_deprecated=False,
),
ConfigChange(
config=ConfigParameter("webserver", "default_ui_timezone"),
was_deprecated=False,
),
# policy
ConfigChange(
config=ConfigParameter("policy", "airflow_local_settings"),
Expand Down
10 changes: 0 additions & 10 deletions airflow-core/src/airflow/config_templates/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1723,16 +1723,6 @@ webserver:
type: string
example: ~
default: "Access is Denied"
default_ui_timezone:
description: |
Default timezone to display all dates in the UI, can be UTC, system, or
any IANA timezone string (e.g. **Europe/Amsterdam**). If left empty the
default value of core/default_timezone will be used
version_added: 1.10.10
type: string
example: "America/New_York"
# Default is left as UTC for now so the date's don't "suddenly" change on upgrade
default: "UTC"
secret_key:
description: |
Secret key used to run your api server. It should be as random as possible. However, when running
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1191,10 +1191,6 @@ export const $ConfigResponse = {
type: "integer",
title: "Auto Refresh Interval",
},
default_ui_timezone: {
type: "string",
title: "Default Ui Timezone",
},
hide_paused_dags_by_default: {
type: "boolean",
title: "Hide Paused Dags By Default",
Expand Down Expand Up @@ -1252,7 +1248,6 @@ export const $ConfigResponse = {
"navbar_logo_text_color",
"page_size",
"auto_refresh_interval",
"default_ui_timezone",
"hide_paused_dags_by_default",
"instance_name",
"instance_name_has_markup",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,6 @@ export type ConfigResponse = {
navbar_logo_text_color: string;
page_size: number;
auto_refresh_interval: number;
default_ui_timezone: string;
hide_paused_dags_by_default: boolean;
instance_name: string;
instance_name_has_markup: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,14 @@
import { useMemo, type PropsWithChildren } from "react";
import { useLocalStorage } from "usehooks-ts";

import { useConfig } from "src/queries/useConfig";

import { TimezoneContext, type TimezoneContextType } from "./Context";

const TIMEZONE_KEY = "timezone";

export const TimezoneProvider = ({ children }: PropsWithChildren) => {
const defaultUITimezone = useConfig("default_ui_timezone");
const systemTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone;

const [selectedTimezone, setSelectedTimezone] = useLocalStorage(
TIMEZONE_KEY,
typeof defaultUITimezone === "string" ? defaultUITimezone : "UTC",
);
const [selectedTimezone, setSelectedTimezone] = useLocalStorage(TIMEZONE_KEY, systemTimezone);

const value = useMemo<TimezoneContextType>(
() => ({ selectedTimezone, setSelectedTimezone }),
Expand Down
1 change: 0 additions & 1 deletion airflow-core/src/airflow/ui/src/mocks/handlers/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export const handlers: Array<HttpHandler> = [
audit_view_excluded_events: "gantt,landing_times,tries,duration,calendar,graph,grid,tree,tree_data",
audit_view_included_events: "",
auto_refresh_interval: 3,
default_ui_timezone: "UTC",
default_wrap: false,
enable_swagger_ui: true,
hide_paused_dags_by_default: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"navbar_logo_text_color": "#51504f",
"page_size": 100,
"auto_refresh_interval": 3,
"default_ui_timezone": "UTC",
"hide_paused_dags_by_default": False,
"instance_name": "Airflow",
"instance_name_has_markup": False,
Expand Down Expand Up @@ -60,7 +59,6 @@ def mock_config_data():
"navbar_logo_text_color": "#51504f",
"page_size": "100",
"auto_refresh_interval": "3",
"default_ui_timezone": "UTC",
"hide_paused_dags_by_default": "false",
"instance_name": "Airflow",
"instance_name_has_markup": "false",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@ def init_jinja_globals(app, enable_plugins: bool):
elif server_timezone == "utc":
server_timezone = "UTC"

default_ui_timezone = conf.get("webserver", "default_ui_timezone")
if default_ui_timezone == "system":
default_ui_timezone = pendulum.local_timezone().name # type: ignore[operator]
elif default_ui_timezone == "utc":
default_ui_timezone = "UTC"
if not default_ui_timezone:
default_ui_timezone = server_timezone

expose_hostname = conf.getboolean("webserver", "EXPOSE_HOSTNAME")
hostname = get_hostname() if expose_hostname else "redact"

Expand All @@ -59,7 +51,6 @@ def init_jinja_globals(app, enable_plugins: bool):
def prepare_jinja_globals():
extra_globals = {
"server_timezone": server_timezone,
"default_ui_timezone": default_ui_timezone,
"hostname": hostname,
"navbar_color": conf.get("webserver", "NAVBAR_COLOR"),
"navbar_text_color": conf.get("webserver", "NAVBAR_TEXT_COLOR"),
Expand Down
1 change: 0 additions & 1 deletion providers/fab/tests/unit/fab/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ def local_context(self):
"appbuilder",
"base_template",
"server_timezone",
"default_ui_timezone",
"hostname",
"navbar_color",
"navbar_text_color",
Expand Down