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

csv: convert datetimes with time zones to local date, mostly (WIP) #1583

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

simonmichael
Copy link
Owner

@simonmichael simonmichael commented Jun 26, 2021

Just sharing this.. it's an attempt to fix this CSV limitation I just noticed, dates from other timezones can be off by one:

fc364cd origin/master ;doc: csv: note a limitation with datetimes in other zones

I have abandoned it for now, because (in a non-UTC timezone) dates with no time/timezone all get adjusted, as they are parsed as 00:00:00 UTC. Perhaps with a bit more work this could be useful (somehow use local timezone as the default when parsing ? Convert to local date only when timezone-related strptime codes (%z, %ez, %Z, %eZ) appear in date-format ?

Related: haskell/time#172. This PR doesn't handle the daylight-savings inaccuracy mentioned there, but I think it would still improve the date in most cases (off by one errors would still be possible, but rather rare for most people). Adding the tz package as a dependency could allow "perfect" accuracy, but only for past dates, as far as I understand it. <- a mistake ? Hopefully.

@simonmichael simonmichael marked this pull request as draft June 26, 2021 00:41
@simonmichael simonmichael added the csv The csv file format, csv output format, or generally CSV-related. label Jun 26, 2021
Abandoned for now, because in a non-UTC timezone, dates with no
time/timezone all get adjusted (they are assumed to be 00:00:00 UTC).
@simonmichael simonmichael force-pushed the master branch 8 times, most recently from 56bc295 to 01f9c70 Compare July 11, 2021 09:26
@simonmichael simonmichael added needs:code To unblock: needs code/code updates needs:design To unblock: needs more thought/planning, leading to a spec/plan labels Aug 8, 2021
@simonmichael simonmichael added needs:code To unblock: needs code/code updates needs:design To unblock: needs more thought/planning, leading to a spec/plan and removed needs:design To unblock: needs more thought/planning, leading to a spec/plan needs:code To unblock: needs code/code updates labels Aug 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
csv The csv file format, csv output format, or generally CSV-related. needs:code To unblock: needs code/code updates needs:design To unblock: needs more thought/planning, leading to a spec/plan
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant