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

support Date objects #56

Open
skeggse opened this issue Apr 1, 2020 · 1 comment
Open

support Date objects #56

skeggse opened this issue Apr 1, 2020 · 1 comment

Comments

@skeggse
Copy link

skeggse commented Apr 1, 2020

Currently, jsesc produces unsupported code when passed a Date object:

jsesc({ value: new Date() })
// => '{\'value\':Tue Mar 31 2020 18:06:06 GMT-0700 (Pacific Daylight Time)}'

Ideally, this would produce a constructor for that date/time. I'm happy to implement - I'm thinking it'd just use the valueOf unless there's a good argument for using the ISO 8601 format.

@mathiasbynens
Copy link
Owner

Sounds good. The only reason I haven't added support for this is because I haven't had the need. Happy to review a patch!

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

Successfully merging a pull request may close this issue.

2 participants