Makes request obey the timestampFormat in the service api by converting ... #89

Closed
wants to merge 4 commits into
from

Projects

None yet

3 participants

@cjhanks
Contributor
cjhanks commented Mar 28, 2013

Following: #85

I opted to revert attempts to clone the object in order for data to be immutable upon request. This version passes all tests afaict.

@trevorrowe trevorrowe added a commit that closed this pull request Apr 17, 2013
@trevorrowe trevorrowe Resolved a few issues with Date params.
* All three serializers (JSON, Query and XML) accept dates
  as Date objects, strings and unix timestamps (numbers)

* All three serializers (JSON, Query and XML) now obey the
  configured timestamp formats, including:

  * iso8601
  * rfc822
  * unixTimestamp

Fixes #89
Fixes #99
e579b41
@trevorrowe
Member

Thanks for bringing this issue to our attention and for the pull request. I just pushed a commit that resolves this issue for all three serializers and makes them accept a wider variety of date formats as inputs. Please let us know if this doesn't resolve the issue for you.

@devilelephant

Is there any progress on this? I'm trying to use SWF and ran into the same Date parameter serialization problems as demonstrated on #84

It appears the only way to pass Date parameters into SWF safely is to call getTime() on them explicitly.

swf.listOpenWorkflowExecutions({domain: 'myDomain', startTimeFilter: {oldestDate: oldDate.getTime() / 1000}}, 
    function (err, data) {
        if (err) { throw err; }
    console.log(data);
});

Edit: Learned I need to divide oldDate.getTime() by 1000 because oldestDate needs "seconds" instead of millis. Still, I would expect the API to just take the JavaScript Date() object as is and serialize it on my behalf.

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