fix: date-only column display shifted one day behind in non-UTC timezones - #2882
fix: date-only column display shifted one day behind in non-UTC timezones#2882tareko wants to merge 1 commit into
Conversation
…ones
The formatValue method for datetime-date columns parsed date-only values
(e.g. "2025-08-25") using the datetime format 'YYYY-MM-DD HH:mm:ss'.
Since the input doesn't match the format, Moment.js falls back to ISO 8601
parsing, which interprets date-only strings as UTC midnight. When
.format('ll') then converts to the user's local timezone, the date shifts
back one day for users behind UTC (e.g. America/Toronto UTC-4).
Fix: use 'YYYY-MM-DD' as the Moment parse format, which matches the actual
value and ensures local-timezone parsing. This is consistent with
getDateFormat() in TableCellDateTime.vue, which already uses 'YYYY-MM-DD'
for the edit mode (and editing correctly showed the right date).
Fixes nextcloud#2705
Signed-off-by: Tarek <shopping@tarek.org>
Assisted-by: GLM:5.2
3588be0 to
8be57c2
Compare
There was a problem hiding this comment.
Pull request overview
Fixes an off-by-one-day display bug for date-only columns in the Nextcloud Tables frontend when viewed in timezones behind UTC by ensuring date strings are parsed using the correct date-only format.
Changes:
- Update
DatetimeDateColumn.formatValue()to parse stored date-only values usingYYYY-MM-DD(matching the stored format) before formatting for display.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
Bug
The discovery of this bug and code to fix it were assisted by AI: GLM 5.2
Date-only columns display the date one day behind the entered value for users in timezones behind UTC (e.g. America/Toronto UTC-4).
Steps to reproduce:
Root cause
In
datetimeDate.js,formatValueparsed date-only values (e.g."2025-08-25") using the datetime format'YYYY-MM-DD HH:mm:ss':Since the input string doesn't match the format (no time component), Moment.js falls back to ISO 8601 parsing, which interprets date-only strings as UTC midnight. When
.format('ll')then converts to the user's local timezone, the date shifts back one day for users behind UTC.Fix
Use
'YYYY-MM-DD'as the Moment parse format — this matches the actual stored value format and ensures local-timezone parsing:This is consistent with
getDateFormat()inTableCellDateTime.vue, which already uses'YYYY-MM-DD'for the edit mode — explaining why editing showed the correct date while the cell display didn't.Fixes #2705