DartPad ignores Chrome DevTools location override setting
lrhn opened this issue · 0 comments
What happened?
DartPad ignores the location setting in DevTools.
Steps to reproduce problem
Open DevTools (Shift+Ctrl+I), open Sensors tab (is in overflow > "More tools" initially).
Use it to change the location to, fx, "San Francisco".
Enter dartpad.dev
in the browser address line to go to DartPad.
Enter a program which uses DateTime
, like:
void main() {
print(DateTime.now().timeZoneOffset);
}
Run it.
It compiles and prints "2:00:00.000000" which is my actual time zone (DK dayligh saving) and not the expected
"-7:00:00.000000".
If I run JavaScript directly in a page in the same browser, with the same setting,
new Date().getTimeZoneOffset()
returns 420 (aka 7 hours in minutes) as expected.
(Yes, Dart and JS disagrees on the direction of the offset, whether it is added to the local time to get UTC time, or to UTC time to get local time.)
I don't know how DartPad manages to sidestep the DevTools override (I set it before going to DartPad, so it's not caching anything). Maybe it's related to a fix for #1746.
Additional info
Browser
Browser: Chrome
Version: 126.0.6478.126 (Official Build) (64-bit)
Are you using any extensions/plugins that affect website behavior
(particularly those that affect iframes, such as ad blockers)?
Fresh Chrome profile with only deault Google internal extensions.
Are there any warnings or errors in your browser's JavaScript console?
If so, paste them below:
None, only a successful XMLHttpRequest
(main.dart.js:82444 XHR finished loading: POST "https://stable.api.dartpad.dev/api/v3/compileDDC".)
Machine
Operating system: Linux
Version: Debian (rolling Debian testing release "rodete")
Your code
What code was in the editor, if any, when the failure occurred? You
can paste it in below:
void main() {
print(DateTime.now().timeZoneOffset);
}
DartPad's output
Did DartPad print anything to the console pane? If so, paste it below:
No.
If you were running Flutter code, you can also paste an image of the
Flutter output directly into this bug report.
No.