[Feature]: datetime
values parsed by the evaluate
method should be converted to the current context's timezone
#2681
Labels
🚀 Feature Request
when parsing a javascript
Date
object to a pythondatetime
object, playwright correctly parses the string with the UTC timezone, since that's how js dates are are stored internally:playwright-python/playwright/_impl/_js_handle.py
Lines 243 to 247 in 445f80a
however they do not get converted back to the browser context's timezone, which can be a source of bugs when working with
datetime
s in python, for example:i think the solution is for playwright to convert the
datetime
object to the browser context's timezone once it's already been parsed using UTC, so something like this:Example
No response
Motivation
this will make it less likely for users to accidentally introduce timezone-related bugs in their code.
The text was updated successfully, but these errors were encountered: