Fixes issue when a date is serialized as a Unix timestamp #483

Merged
merged 2 commits into from Nov 20, 2012

Conversation

Projects
None yet
2 participants
Contributor

iperdomo commented Nov 19, 2012

Basically the code was trying to use a search function on a Number which is not correct.

The pull request includes a failing test case.

Building Ember Data...
Done
Running: package=all, package=all&jquery=1.7.2&nojshint=true, package=all&extendprototypes=true&nojshint=true, package=all&extendprototypes=true&jquery=1.7.2&nojshint=true, package=all&dist=build&nojshint=true
Running: {"package":"all"}
Module Failed: Default DS.Transforms
  Test Failed: the default date transform
    Assertion Failed: Died on test #3     at file:///home/iperdomo/workspace/www/m/ember-data/tests/qunit/qunit.js:343
    at :118
    at :120: 'undefined' is not a function (evaluating 'serialized.search(/^\d{4}-\d{2}-\d{2}$/)')
Time: 2047ms, Total: 1289, Passed: 1288, Failed: 1
Tests Failed

After the fix

Building Ember Data...
Done
Running: package=all, package=all&jquery=1.7.2&nojshint=true, package=all&extendprototypes=true&nojshint=true, package=all&extendprototypes=true&jquery=1.7.2&nojshint=true, package=all&dist=build&nojshint=true
Running: {"package":"all"}
Time: 2029ms, Total: 1290, Passed: 1290, Failed: 0
Running: {"package":"all","jquery":"1.7.2","nojshint":"true"}
Time: 1496ms, Total: 1231, Passed: 1231, Failed: 0
Running: {"package":"all","extendprototypes":"true","nojshint":"true"}
Time: 1489ms, Total: 1231, Passed: 1231, Failed: 0
Running: {"package":"all","extendprototypes":"true","jquery":"1.7.2","nojshint":"true"}
Time: 1507ms, Total: 1231, Passed: 1231, Failed: 0
Running: {"package":"all","dist":"build","nojshint":"true"}
Time: 1494ms, Total: 1231, Passed: 1231, Failed: 0
Tests Passed

iperdomo added some commits Nov 19, 2012

@iperdomo iperdomo Number object doesn't have a search method
- If your REST service returns a Date as a number, the deserialization
  fails because the transform fromData tries to use search on a number
332f3f1
@iperdomo iperdomo Added test for tranforming a timestamp (number) into a Date 1a84690

@wycats wycats added a commit that referenced this pull request Nov 20, 2012

@wycats wycats Merge pull request #483 from iperdomo/master
Fixes issue when a date is serialized as a Unix timestamp
a8d85d7

@wycats wycats merged commit a8d85d7 into emberjs:master Nov 20, 2012

1 check passed

default The Travis build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment