Skip to content

Commit c4ffd45

Browse files
authored
fix: datetime serialisation (microsoft#2314)
1 parent 516bdad commit c4ffd45

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

playwright/_impl/_js_handle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def serialize_value(
128128
if math.isnan(value):
129129
return dict(v="NaN")
130130
if isinstance(value, datetime):
131-
return dict(d=value.isoformat() + "Z")
131+
return dict(d=value.isoformat())
132132
if isinstance(value, bool):
133133
return {"b": value}
134134
if isinstance(value, (int, float)):

tests/sync/test_assertions.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import datetime
1516
import re
16-
from datetime import datetime
1717

1818
import pytest
1919

@@ -163,7 +163,11 @@ def test_assertions_locator_to_have_js_property(page: Page, server: Server) -> N
163163
)
164164
expect(page.locator("div")).to_have_js_property(
165165
"foo",
166-
{"a": 1, "b": "string", "c": datetime.utcfromtimestamp(1627503992000 / 1000)},
166+
{
167+
"a": 1,
168+
"b": "string",
169+
"c": datetime.datetime.fromtimestamp(1627503992000 / 1000),
170+
},
167171
)
168172

169173

0 commit comments

Comments
 (0)