Skip to content
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

DartPad ignores Chrome DevTools location override setting #3026

Open
lrhn opened this issue Jul 3, 2024 · 0 comments
Open

DartPad ignores Chrome DevTools location override setting #3026

lrhn opened this issue Jul 3, 2024 · 0 comments
Labels
type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@lrhn
Copy link
Member

lrhn commented Jul 3, 2024

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.

@lrhn lrhn added the type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) label Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

1 participant