Merge pull request #6920 from SylvainCorlay/serialize_date

Dates and Strings are JavaScript objects, and _pack_models behaves incorrectly in these cases.
This commit is contained in:
Min RK 2014-11-13 12:26:02 -08:00
commit f569ccc58f
2 changed files with 3 additions and 1 deletions

View File

@ -236,7 +236,8 @@ define(["widgets/js/manager",
packed.push(that._pack_models(sub_value));
});
return packed;
} else if (value instanceof Date || value instanceof String) {
return value;
} else if (value instanceof Object) {
packed = {};
_.each(value, function(sub_value, key) {

View File

@ -81,6 +81,7 @@ casper.notebook_test(function () {
test_packing([1, false]);
test_packing([1, false, {a: 'hi'}]);
test_packing([1, false, ['hi']]);
test_packing([String('hi'), Date("Thu Nov 13 2014 13:46:21 GMT-0500")])
// Test multi-set, single touch code. First create a custom widget.
this.evaluate(function() {