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

Fix date parsing #292

Closed
zedd3v opened this issue Jun 12, 2021 · 4 comments
Closed

Fix date parsing #292

zedd3v opened this issue Jun 12, 2021 · 4 comments

Comments

@zedd3v
Copy link

zedd3v commented Jun 12, 2021

Date.parse('December 04, 1986')

Expected: 534034800000

Got: NaN

@Duske
Copy link

Duske commented Jun 22, 2021

It also did not work for me with Date.parse("Tue, 22 Jun 2021 13:54:40 GMT")

@dop251
Copy link
Owner

dop251 commented Aug 14, 2021

@zedd3v The expected return value should actually be 534038400000, because date only formats are treated as UTC (see my comment in #281).

@Duske This expression works for me, are you sure you're using the latest version?

@Duske
Copy link

Duske commented Aug 17, 2021

It occured in latest k6 load generator. When I investigated it, they use a recent version of goja: https://github.com/grafana/k6/blob/41712f75726c9451d2c3d04a1a806709c31de484/go.mod#L11

@mstoykov
Copy link
Contributor

@Duske it seems to work for me and returning 1624370080000 including for the last 4 versions of k6. I get the same value in a browser(firefox) and I get the same using date on the cli.

Can you provide a script that does actually return the wrong value?

Also, I would prefer k6 bugs to be reported to k6 we can escalate them to goja if/when needed ;)

@dop251 dop251 closed this as completed in 6338b32 Sep 4, 2021
Gabri3l added a commit to mongodb-forks/goja that referenced this issue Feb 4, 2022
…formats, ... (#47)

* Fixed typed arrays' defineProperty and indexing. Fixes dop251#308.
* Fix Proxy creation panicing on target not callable
* Do not modify sb for variadic calls as it breaks local variables resolution. Instead place a marker on stack and use it to count the number of args. Fixes dop251#311.
* Support patterns in catch clause. See dop251#305
* Fixed the handling of Symbol properties in destructuring assignments. Fixes dop251#312.
* Ensure ToPropertyKey happens earlier when assigning computed keys. Fixes dop251#312.
* Aligned detached buffer semantics with the latest specs. Fixes dop251#315.
* More typed arrays fixes
* Fixed accessor and property key function names. Fixes dop251#314.
* Fixed possible panic when sorting non-standard arrays.
* Added nil-safety checks for values returned by get*() methods
* Fixed panics in parser on some invalid inputs. Fixes dop251#318.
* Arrow function (dop251#319)
* Implemented arrow functions. See dop251#304.
* Define the name property for anonymous functions (including arrow functions)
* Treat "arguments" as a lexical binding to match the latest specification
* Allow arrow functions to contain 'use strict' for simple parameter lists. Fixes dop251#323.
* Fixed argument variable reference resolution in stashless functions
* Treat date-only formats as UTC and date-time as local timezone. Added support for additional datetime formats. Fixes dop251#281, fixes dop251#292.
* Use correct createArgsRest variant when arguments are not in stash. Fixes dop251#327
* Fixed formatting for go 1.17
* Report 'length' as own property for Go slices. Fixes dop251#328.
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

4 participants