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

MapperUtils dateTransformer() returns '1970-01-01' when null is provided #3

Open
dbleakley opened this issue Nov 17, 2016 · 1 comment

Comments

@dbleakley
Copy link
Contributor

It looks like the dateTransforms may not be handling null or undefined input as expected.

Given the following test-case:

        expect(mapperUtils.dateTransformer(null)).to.be.undefined;

The dateTransformer returns '1970-01-01'.

Would it be reasonable to expect these transformers to return undefined in the event the input data is not truthy and/or possibly when the string is not a valid format -- moment(date_string).isValid === false?

@seanpk
Copy link
Member

seanpk commented Nov 17, 2016

that sounds reasonable ... the "1970-01-01" only makes sense to a developer
since this function is for the mapping context, I think it makes sense for it to return undefined.

@dannylevenson - do you have an opinion?

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