Skip to content

Use of 'toLocaleString' when converting date values #146

@meelash

Description

@meelash

Wasn't sure if this would be seen in the closed issue, so, creating a new issue here:

I have another use case for this: #64 , wondering if this is still a possibility to get implemented, and/or if there is a better way currently to accomplish what I'm seeking.
By default datetimes will be converted to UTC when creating a csv, since that is what Date.prototype.toString() does. Generally, I'm guessing this would not be desired behavior.

Example:

{
  startTime: new Date('2020-03-05 16:34:39')
}

If my local timezone is EST, json2csv output will be:

startTime
'2020-03-05 21:34:39'

Is there a way I can (even a temporary fix) get json2csv to use toLocaleString or any other way to get dates to convert to a string in the local timezone?

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions