Skip to content

createPatch does not support Date type #100

Description

@hollandjake

Following on from #78 , createPatch should have Date handling added so that JS objects with a Date object inside are handled correctly.

Currently they are effectively ignored.

const userA = { createdAt: new Date(2010, 7, 10, 22, 10, 48) };
const userB = { createdAt: new Date(2011, 7, 10, 22, 10, 48) };
const patch = createPatch(userA, userB);
// []

This is because in the current handling of diff, Date objects get read as an object type and so it attempts to iterate over its keys of which there are none, resulting in an empty patch despite the value being different.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions