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

Unreleased versions will be included when querying since 1970 #646

Closed
g-plane opened this issue Nov 15, 2021 · 1 comment
Closed

Unreleased versions will be included when querying since 1970 #646

g-plane opened this issue Nov 15, 2021 · 1 comment

Comments

@g-plane
Copy link
Member

@g-plane g-plane commented Nov 15, 2021

When querying since 1970, it will be parsed into the UNIX timestamp 0. On the other hand, in caniuse-lite data, release date of unreleased versions are null.

Now, when processing since query, there is a comparison logic:

return data.releaseDate[v] >= since
.

In JavaScript, null >= 0 will be evaluated to true, which causes unreleased versions will be included in the result when querying since 1970.

I'm not sure whether it's a bug or not. I found this problem when I was implementing since query in browserslist-rs, and currently I implemented this feature/bug as-is: https://github.com/g-plane/browserslist-rs/blob/35ed72f516ab1230d0c102169a9bbe25f493fedb/src/queries/since.rs#L53-L62 .

@ai
Copy link
Member

@ai ai commented Nov 15, 2021

Wow, crazy bug. Thanks.

I will add special logic for null. We should not use data.releaseDate[v] === null in any since X query.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants