Project

General

Profile

problems with Redmine 2.0.2 date parsing - old format again

Added by Alex Last over 12 years ago

hi!
I remember Redmine switched to a new date format in REST API responses (XML format) in version 1.1, which caused Redmine Java API (and all other remote clients, obviously) breakage.
another date parsing problem was just reported by someone who was trying to use Redmine Java API with Redmine 2.0.2:
it switched back to the OLD date format (used by Redmine 1.0) in JSON requests. https://github.com/taskadapter/redmine-java-api/issues/39

we can't determine, which Redmine we're working with to apply the proper date parsing mask because a request to provide redmine version is still pending after 2 years: http://www.redmine.org/issues/5901
(my guess is it should be 10 minutes of work...).

if we want to have a reliable Java API for Redmine, we need to be able to identify Redmine version or just expect that date format will always be the same for all XML and Json requests in all Redmine versions.


Replies (8)

RE: problems with Redmine 2.0.2 date parsing - old format again - Added by Jean-Philippe Lang over 12 years ago

The problem with JSON is that there's no standard way to serialize a date or time AFAIK. There was no change on the Redmine side but it seems that ActiveSupport changed the way dates are serialized to JSON. Rather than relying on the Redmine version, a safer solution would be to support both formats when parsing JSON.

RE: problems with Redmine 2.0.2 date parsing - old format again - Added by Etienne Massip over 12 years ago

Actually the 'Z' is also present instead of the timezone in the xml version.

RE: problems with Redmine 2.0.2 date parsing - old format again - Added by Etienne Massip over 12 years ago

While the TimeZone information is correctly set on redmine.org, for example.

RE: problems with Redmine 2.0.2 date parsing - old format again - Added by Etienne Massip over 12 years ago

Setting the config.time_zone to a vaue in config/application.rb seems to fix this.

RE: problems with Redmine 2.0.2 date parsing - old format again - Added by Jean-Philippe Lang over 12 years ago

Both formats (eg. "2012/06/16 22:48:47 +0200" and "2012-06-16T20:48:47Z") are correctly parsed in javascript so I guess they are both valid in a JSON output.

Etienne Massip wrote:

Actually the 'Z' is also present instead of the timezone in the xml version.

What is the problem with that?

RE: problems with Redmine 2.0.2 date parsing - old format again - Added by Etienne Massip over 12 years ago

Sorry I thought the Z was designed to be replaced by the TimeZone?

RE: problems with Redmine 2.0.2 date parsing - old format again - Added by Jean-Philippe Lang over 12 years ago

They're just supposed to be valid XML dateTime. Timezone'd or zulu times are fine.

    (1-8/8)