Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apply strips Date when applying changes #9

Open
lloydh6 opened this issue Feb 27, 2020 · 1 comment
Open

apply strips Date when applying changes #9

lloydh6 opened this issue Feb 27, 2020 · 1 comment

Comments

@lloydh6
Copy link

lloydh6 commented Feb 27, 2020

When using apply on two objects, any property that is null on obj1 and a date in obj2 results in the returning value becoming an empty object.

Here is the code that is being run


const obj1 = {
  date: null,
  name: 'first',
};

const obj2 = {
  date: new Date(),
  name: 'first',
};

const result = apply(obj1, obj2); // Result is { date: {}, name: 'first' }

Is it by design that the result of the apply is { date: {}, name: 'first' }?

@pierreinglebert
Copy link
Owner

This lib is for handling JSON and JSON does not specify how dates should be serialized so it's kinda an expected behavior. Maybe it's possible to call "toJSON()" for objects having a serialization specified in JS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants