Skip to content

getPageInfo returns an incorrect modification date #23

@flohmueller

Description

@flohmueller

Hi Guillaume,

I had an issue regarding timestamp comparison between the modification timestamp from getPageInfo and another timestamp. The one to blame is not really the DokuJClient.. but here's what I found out:

In its RemoteAPICore.php->pageInfo function DokuWiki uses a date to string conversion which finally calls gmdate to extract year, month, day, hour, minute and second; thus, the result is in GMT.

The XMLRPC library you're using (de.timroes aXMLRPC) seems to parse the timestamp with the pattern yyyyMMdd'T'HH:mm:ss (see DateTimeSerializer), without a timezone.
That's fine, as there's no timezone information in the answer from DokuWiki. But without a timezone the resulting date is considered to be in the client's timezone.

So it's likely more an issue for the XMLRPC library... e.g. to set a custom DateTimeSerializer, a default timezone for the DateTimeSerializer, and/or a flag to include timezone parsing.

I don't know if you want to try to do anything about that issue.. at least it is documented now ;)

My workaround looks like this: new SimpleDateFormat("yyyyMMddHHmmssz").parse(new SimpleDateFormat("yyyyMMddHHmmss").format(modified) + "GMT").

  1. date -> string without timezone
  2. add timezone information (we know DokuWiki's output is in GMT)
  3. parse again, this time including timezone information

Another workaround might be to tweak DokuWiki to output the modification date in the desired timezone.

In an ideal world, DokuWiki's date transformation would include timezone information which in turn would be parsed by the XMLRPC library's DateTimeSerializer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions