heroku/databasedotcom — Issue #35: DateTime deserialize error when saving an object with a valid formatted date time
Author: javierjulio
Created: 2011-11-10 17:51:28+00:00
State: open

I'm getting a parser error when saving any object (in my case Accounts) with a datetime. I'm on Ruby 1.8.7. Here is a sample date from the db: ```2011-11-05 23:43:51 UTC``` which the gem converts to: ```2011-09-13T20:57:42.L+0000``` Ruby 1.8.7 doesn't support ```%L``` in strftime so I edited the gem source locally to another valid format: ```YYYY-MM-DDThh:mm:ssZ``` and I still receive the same error despite the date format being valid as specified in the API docs (http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_select_dateformats.htm). The error is:

Cannot deserialize instance of datetime from VALUE_STRING value 2011-09-13T20:57:42Z

```
/Users/JavierJulio/.rbenv/versions/1.8.7-p352/lib/ruby/gems/1.8/bundler/gems/databasedotcom-6d89ce70f4ba/lib/databasedotcom/client.rb:376:in `ensure_expected_response': Cannot deserialize instance of datetime from VALUE_STRING value 2011-09-13T20:57:42Z at [line:1, column:574] (Databasedotcom::SalesForceError)
from /Users/JavierJulio/.rbenv/versions/1.8.7-p352/lib/ruby/gems/1.8/bundler/gems/databasedotcom-6d89ce70f4ba/lib/databasedotcom/client.rb:334:in `with_encoded_path_and_checked_response'
from /Users/JavierJulio/.rbenv/versions/1.8.7-p352/lib/ruby/gems/1.8/bundler/gems/databasedotcom-6d89ce70f4ba/lib/databasedotcom/client.rb:316:in `http_patch'
from /Users/JavierJulio/.rbenv/versions/1.8.7-p352/lib/ruby/gems/1.8/bundler/gems/databasedotcom-6d89ce70f4ba/lib/databasedotcom/client.rb:250:in `update'
from /Users/JavierJulio/.rbenv/versions/1.8.7-p352/lib/ruby/gems/1.8/bundler/gems/databasedotcom-6d89ce70f4ba/lib/databasedotcom/sobject/sobject.rb:103:in `save'
```

The field that gets that value is a custom field, type DateTime. Any ideas why the API could still be throwing a parse error despite the datetime being correct? Will the databasedotcom gem support Ruby 1.8.7? As the strftime used when parsing datetime from the API result uses %L which isn't supported in 1.8.7.