Skip to content

Incorrect Timestamp Handling for Created Tasks #2286

@Carltoffel

Description

@Carltoffel

Issue Description:

I am experiencing an issue with the Nextcloud Tasks app on my Nextcloudpi server. The problem seems to be related to incorrect handling and interpretation of timestamps, specifically with the "created" (and maybe also the "modified") field.

Steps to Reproduce:

  1. Create a task using the Tasks app on the Nextcloudpi server or synchronize a task from an Android device using the DAVx5 app (if your time zone is UTC, you might not be able to reproduce this).
  2. Check the timestamp of the created task in both the browser interface and the Android device.

Current Behavior:

The timestamp of the created task is displayed incorrectly on the Nextcloudpi server compared to the Android device. The server seems to ignore the time zone information, resulting in a time discrepancy (and I assume this causes the synchronization issues I have).

Expected Behavior:

The timestamp of the created task should be consistent across all devices and reflect the correct time, considering the time zone.

Additional Information:

Nextcloud Version: NextCloudPi 25.0.6
Tasks App Version: 0.15.0
Android Device: Fairphone 3+
DAVx5 Version: 4.3.4-ose
Time Zone Settings: Both Raspberry and Phone are in CEST (UTC+2)

Code Reference:

I noticed the following code snippet in the Tasks app that might be related to the issue:

set created(createdDate) {
    this.vtodo.updatePropertyWithValue('created', createdDate)
    this.updateLastModified()
    this._created = this.vtodo.getFirstPropertyValue('created')
    this._createdMoment = moment(this._created, 'YYYYMMDDTHHmmss')
    // Update the sortorder if necessary
    if (this.vtodo.getFirstPropertyValue('x-apple-sort-order') === null) {
        this._sortOrder = this.getSortOrder()
    }
}

It appears that the date might not be properly converted to the UTC time zone, which could lead to discrepancies in timestamp interpretation.

A task created in the browser has the date format:

CREATED:20230616T112858

And a task created on my phone has the date format:

CREATED:20230616T092913Z

Both Tasks were created at almost the same time.

Note: It's hard to tell what exactly is going on, so I'm not 100% sure if this is caused by the tasks app. But after playing around and testing different things for over one hour, I'm quite sure, that the problem would be solved, if the tasks app would write it's dates in UTC (and add the Z to make it clear).

Please let me know if any additional information is needed to address this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions