Skip to content

Commit 1074c38

Browse files
committed
test(datetime): tests/js/py2js/datetime.simple should pass
1 parent 5db7312 commit 1074c38

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/js/py2js/datetime.simple.failing renamed to tests/js/py2js/datetime.simple

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
const throughJS = x => x;
1212
var expectedJsTimestamp;
13+
var actualJsTimestamp;
1314
var jsDate;
1415
var pyDate;
1516

@@ -35,9 +36,10 @@ python.exec(`import datetime`);
3536
pyDate = python.eval(`datetime.datetime.fromtimestamp(${expectedJsTimestamp}, tz=timezone.utc)`);
3637
jsDate = throughJS(pyDate);
3738

38-
if (jsDate.getTime() !== expectedJsTimestamp)
39+
actualJsTimestamp = jsDate.getTime() / 1000; // JS timestamp is in milliseconds, convert it to seconds
40+
if (actualJsTimestamp !== expectedJsTimestamp)
3941
{
40-
console.error('expected', expectedJsTimestamp, 'but got',jsDate.getTime());
42+
console.error('expected', expectedJsTimestamp, 'but got', actualJsTimestamp);
4143
throw new Error('test failed');
4244
}
4345

0 commit comments

Comments
 (0)