openxlsx icon indicating copy to clipboard operation
openxlsx copied to clipboard

createWorkbook "Created" date is offset by timezone difference

Open michael-m52 opened this issue 3 years ago • 3 comments

Describe the bug The "Created" date and time that appears in the Info section is out by the timezone offset. It is 5pm here now, when I ran the code, screenshot is showing "4am tomorrow"

It appears that createWorkbook creates coreProperties > dcterms:created with local time, but Excel is expecting UTC

To Reproduce

library("openxlsx")
wb=createWorkbook()
print(wb$core)
saveWorkbook(wb,"test.xlsx",overwrite = T)

Output of wb$core

<coreProperties xmlns=\"http://schemas.openxmlformats.org/package/2006/metadata/core-properties\" xmlns:cp=\"http://schemas.openxmlformats.org/package/2006/metadata/core-properties\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><dc:creator>michael-m52</dc:creator><cp:lastModifiedBy>michael-m52</cp:lastModifiedBy><dcterms:created xsi:type=\"dcterms:W3CDTF\">2022-02-28T17:00:36Z</dcterms:created></coreProperties>

Expected behavior Screenshot below should show 5pm

Screenshots image

Example files test.xlsx

michael-m52 avatar Feb 28 '22 06:02 michael-m52

This should be fixed in development as well. Please let me know if it works as intended :)

JanMarvin avatar Mar 10 '22 17:03 JanMarvin

This works perfectly in the development branch

michael-m52 avatar Mar 17 '22 03:03 michael-m52

Thanks for testing and glad that we've fixed it

JanMarvin avatar Mar 17 '22 08:03 JanMarvin

This issue is stale because it has been open 365 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar May 20 '23 02:05 github-actions[bot]

This issue was closed because it has been stalled for 7 days with no activity.

github-actions[bot] avatar May 27 '23 02:05 github-actions[bot]