New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 908550 link

Starred by 3 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac , Fuchsia
Pri: 3
Type: Feature



Sign in to add a comment

Add onTimeZoneChange event

Project Member Reported by js...@chromium.org, Nov 26

Issue description

This is a feature request. See https://github.com/whatwg/html/pull/3047 .

When there's a change in timezone, it'd be very useful to fire an event so that web apps (such as calendar, web-based mail, numerous others that need to show date/time ) can update the date/time displayed by listening to it. 

Currently, either users have to reload web pages after a timezone change or web apps have to poll on a regular basis to detect a timezone change. 

Blink>DOM may not be a good choice, but I'm not sure of any other component (other than 'Blink).  Other event APIs are dealt with in Blink>Input, Blink>GamePad (event specific components).  
 
Cc: gsat...@chromium.org
BTW, Blink does have a timezone monitor to detect the timezone change in the OS. When a timezone change is detected, it's sent down to v8 engine and its timezone is updated. 

Cc: mlamouri@chromium.org
Components: -Blink>DOM Blink>HTML
 bug 365123  is about languagechange event. 

https://www.chromestatus.com/features/6056371904577536

 bug 276159  is about languagechange event in worker. 


Cc: kdillon@chromium.org
Components: -Blink Blink>Workers
The proposal is to add it to worker as well. 

I think the following code  used to hook up with the v8::Date::DateTimeConfigurationChangeNotification is related

https://cs.chromium.org/chromium/src/third_party/blink/renderer/modules/time_zone_monitor/time_zone_monitor_client.cc?q=DateTimeConfigurationChangeNotification&dr=C

void NotifyTimezoneChangeToV8(v8::Isolate* isolate) {
  DCHECK(isolate);
  v8::Date::DateTimeConfigurationChangeNotification(isolate);
}

void NotifyTimezoneChangeOnWorkerThread(WorkerThread* worker_thread) {
  DCHECK(worker_thread->IsCurrentThread());
  NotifyTimezoneChangeToV8(ToIsolate(worker_thread->GlobalScope()));
}

My guess is it require the change to the following files:
src/third_party/blink/renderer/core/frame/window_event_handlers.h
to add a 
DEFINE_STATIC_WINDOW_ATTRIBUTE_EVENT_LISTENER(timezonechange, kTimezonechange);
src/third_party/blink/renderer/core/frame/local_dom_window.h
add TimeZoneChanged

src/third_party/blink/renderer/core/frame/local_dom_window.cc
add
void LocalDOMWindow::TimeZoneChanged() {
  DispatchEvent(*Event::Create(event_type_names::kTimezonechange));
}
also src/services/device/time_zone_monitor/time_zone_monitor.cc
void TimeZoneMonitor::NotifyClients()
Cc: w...@chromium.org leon....@intel.com
cc leon.han@intel.com & watk@chromium.org since they used to work on timezone related monitoring.
Probably a better way to following is orientationchange since both orientation and timzone are bind in https://cs.chromium.org/chromium/src/services/device/device_service.h and event fired in window level
Yeah... orientationchange seems to be a better model for timezone change.

It's fixed in  bug 162827  . 
Labels: OWP-Type-NewAPI
Tangential/digression: I wonder how  bug 651767  is related to  bug 162827 . 
Owner: js...@chromium.org
Status: Assigned (was: Untriaged)
Let's make sure we have a strong resolution to https://github.com/whatwg/html/pull/3047#issuecomment-434257234 before shipping this change.

Sign in to add a comment