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

[Merged by Bors] - Allow Date object to store invalid NativeDateTime #2861

Closed
wants to merge 1 commit into from

Conversation

HalidOdat
Copy link
Member

@HalidOdat HalidOdat commented Apr 23, 2023

Part of ES5.

This PR allows Date objects to store an invalid NativeDateTime as a i64 and check when getMinutes (or other methods) call and check if it's valid, like in the spec

This was failing some Date tests, when calling new Date(8.64e15) then calling getTime() it was returning NaN when it should return the passed value 8640000000000000 (as node does)

@HalidOdat HalidOdat added bug Something isn't working builtins PRs and Issues related to builtins/intrinsics labels Apr 23, 2023
@HalidOdat HalidOdat changed the title Allow Date object to store invalid datetime Allow Date object to store invalid NativeDateTime Apr 23, 2023
@github-actions
Copy link

Test262 conformance changes

Test result main count PR count difference
Total 94,591 94,591 0
Passed 73,167 73,183 +16
Ignored 17,530 17,530 0
Failed 3,894 3,878 -16
Panics 0 0 0
Conformance 77.35% 77.37% +0.02%
Fixed tests (16):
test/built-ins/Date/prototype/setMinutes/new-value-time-clip.js [strict mode] (previously Failed)
test/built-ins/Date/prototype/setMinutes/new-value-time-clip.js (previously Failed)
test/built-ins/Date/prototype/setDate/new-value-time-clip.js [strict mode] (previously Failed)
test/built-ins/Date/prototype/setDate/new-value-time-clip.js (previously Failed)
test/built-ins/Date/prototype/setMonth/new-value-time-clip.js [strict mode] (previously Failed)
test/built-ins/Date/prototype/setMonth/new-value-time-clip.js (previously Failed)
test/built-ins/Date/prototype/setMilliseconds/new-value-time-clip.js [strict mode] (previously Failed)
test/built-ins/Date/prototype/setMilliseconds/new-value-time-clip.js (previously Failed)
test/built-ins/Date/prototype/getTime/this-value-valid-date.js [strict mode] (previously Failed)
test/built-ins/Date/prototype/getTime/this-value-valid-date.js (previously Failed)
test/built-ins/Date/prototype/setSeconds/new-value-time-clip.js [strict mode] (previously Failed)
test/built-ins/Date/prototype/setSeconds/new-value-time-clip.js (previously Failed)
test/built-ins/Date/prototype/setFullYear/new-value-time-clip.js [strict mode] (previously Failed)
test/built-ins/Date/prototype/setFullYear/new-value-time-clip.js (previously Failed)
test/built-ins/Date/prototype/setHours/new-value-time-clip.js [strict mode] (previously Failed)
test/built-ins/Date/prototype/setHours/new-value-time-clip.js (previously Failed)

@codecov
Copy link

codecov bot commented Apr 23, 2023

Codecov Report

Merging #2861 (af29c58) into main (93b52cd) will increase coverage by 0.01%.
The diff coverage is 95.52%.

@@            Coverage Diff             @@
##             main    #2861      +/-   ##
==========================================
+ Coverage   50.92%   50.94%   +0.01%     
==========================================
  Files         419      419              
  Lines       41783    41789       +6     
==========================================
+ Hits        21280    21288       +8     
+ Misses      20503    20501       -2     
Impacted Files Coverage Δ
boa_engine/src/object/builtins/jsdate.rs 0.00% <0.00%> (ø)
boa_engine/src/builtins/date/mod.rs 92.17% <96.87%> (+0.47%) ⬆️
boa_engine/src/builtins/date/utils.rs 98.79% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@HalidOdat HalidOdat marked this pull request as ready for review April 23, 2023 11:46
Copy link
Member

@raskad raskad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@Razican
Copy link
Member

Razican commented Apr 23, 2023

bors r+

bors bot pushed a commit that referenced this pull request Apr 23, 2023
Part of ES5. 

This PR allows `Date` objects to store an invalid `NativeDateTime` as a `i64` and check when `getMinutes` (or other methods) call and check if it's valid, like in the spec

This was failing some `Date` tests, when calling `new Date(8.64e15)` then calling `getTime()` it was returning `NaN` when it should return the passed value `8640000000000000` (as node does)
@bors
Copy link

bors bot commented Apr 23, 2023

Pull request successfully merged into main.

Build succeeded:

@bors bors bot changed the title Allow Date object to store invalid NativeDateTime [Merged by Bors] - Allow Date object to store invalid NativeDateTime Apr 23, 2023
@bors bors bot closed this Apr 23, 2023
@bors bors bot deleted the fix/date-object branch April 23, 2023 17:46
@HalidOdat HalidOdat added this to the v0.17.0 milestone Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working builtins PRs and Issues related to builtins/intrinsics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants