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

Incorrect date + time writing via fwrite (.: 00Z) ISO #5238

Closed
avraam-inside opened this issue Oct 27, 2021 · 1 comment · Fixed by #5249
Closed

Incorrect date + time writing via fwrite (.: 00Z) ISO #5238

avraam-inside opened this issue Oct 27, 2021 · 1 comment · Fixed by #5249
Labels
Milestone

Comments

@avraam-inside
Copy link

avraam-inside commented Oct 27, 2021

Hey!

data.table::fwrite(
  x    = data.table::as.data.table(
          anytime::anytime(1678296152.99999952316284179688)), 
  file = here::here('test.csv'))

If we transfer the following code with a digit to a normal date + time + milliseconds, and then write it to a file, then we get an incorrect record: 2023-03-08T17:22:32.:00Z

Why does fwrite round like this? The problem is that I then need to transfer this record format to another system, and its developers are sure that such a record does not meet any standards (like me) and do not want to change their parsers for this.

On my side, I, of course, did rounding, but I would like to get the correct record right away, not .:00Z

@tlapak
Copy link
Contributor

tlapak commented Nov 1, 2021

Looks like this is an unhandled edge case in the rounding of microseconds to six digits. The correct output should be either 2023-03-08T17:22:33Z or 2023-03-08T17:22:32.000000Z although fwrite currently uses the former when microseconds round down to 0.

@tlapak tlapak mentioned this issue Nov 4, 2021
@mattdowle mattdowle added this to the 1.14.3 milestone Nov 29, 2021
@mattdowle mattdowle added the bug label Nov 29, 2021
@jangorecki jangorecki modified the milestones: 1.14.9, 1.15.0 Oct 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants