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

Add dateUTC flag to CSV Writing #544

Merged
merged 1 commit into from
Apr 19, 2018
Merged

Conversation

zackerydev
Copy link
Contributor

Hello! I am very excited to help contribute to this library as I have been a significant power user for the past year. I can only imagine how much hard work has gone into this.

The problem I had is that when I would create an Excel file with a date type field and write it out as CSV, Moment.js would parse it based on the user's local time. This meant that sometimes when formatting the date into a less verbose format, say (MM/DD/YYYY) it would be off by one day due to the timezone.

This pull request adds an option to the CSV writing module that allows for the user to override this functionality using the moment.utc() function. The advantage here is that less specific date formats (i.e. the cell is originally just MM/DD/YYYY) don't get parsed as the wrong date just because Excel defaults the time to 00:00;

Adding the option may not be the best way to implement this feature but it fixed the issue I was having and hopefully can help alleviate some issues related to dates having unknown behavior.

This prevents the dates from automatically getting converted based on the users local time. This might not be the best way to implement this feature but it might allow people to fix some hidden date bugs when writing to CSV
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 this pull request may close these issues.

2 participants