ycphs / openxlsx

openxlsx - a fast way to read and write complex xslx files
https://ycphs.github.io/openxlsx/
Other
226 stars 75 forks source link

createWorkbook "Created" date is offset by timezone difference #332

Closed michael-m52 closed 1 year ago

michael-m52 commented 2 years ago

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

JanMarvin commented 2 years ago

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

michael-m52 commented 2 years ago

This works perfectly in the development branch

JanMarvin commented 2 years ago

Thanks for testing and glad that we've fixed it

github-actions[bot] commented 1 year ago

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] commented 1 year ago

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