Skip to content

fix: date-only column display shifted one day behind in non-UTC timezones - #2882

Open
tareko wants to merge 1 commit into
nextcloud:mainfrom
tareko:fix/date-display-timezone-shift
Open

fix: date-only column display shifted one day behind in non-UTC timezones#2882
tareko wants to merge 1 commit into
nextcloud:mainfrom
tareko:fix/date-display-timezone-shift

Conversation

@tareko

@tareko tareko commented Aug 9, 2026

Copy link
Copy Markdown

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:

  1. Create a date-only column (not datetime, just date)
  2. Enter a date (e.g. 2025-08-25)
  3. The table view shows the previous day (e.g. Aug 24, 2025)
  4. Clicking to edit shows the correct date — the bug is only in the display

Root cause

In datetimeDate.js, formatValue parsed date-only values (e.g. "2025-08-25") using the datetime format 'YYYY-MM-DD HH:mm:ss':

formatValue(value) {
    return Moment(value, 'YYYY-MM-DD HH:mm:ss').format('ll')
}

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:

formatValue(value) {
    return Moment(value, 'YYYY-MM-DD').format('ll')
}

This is consistent with getDateFormat() in TableCellDateTime.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

@tareko
tareko requested review from blizzz and enjeck as code owners August 9, 2026 04:35
…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
@tareko
tareko force-pushed the fix/date-display-timezone-shift branch from 3588be0 to 8be57c2 Compare August 9, 2026 10:43
@enjeck
enjeck requested a lite review from Copilot August 13, 2026 07:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 using YYYY-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.

@github-actions

Copy link
Copy Markdown
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Viewing date in column 1 day off from date entered

2 participants