jsesc
jsesc copied to clipboard
support Date objects
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.
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!