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

Allow Date type fields to be populated with date string (beside number or Date instance) #46

Closed
royaltm opened this issue Jan 31, 2016 · 2 comments

Comments

@royaltm
Copy link

royaltm commented Jan 31, 2016

It would be very nice if camo validator would accept field with declared type Data values as strings.
Currently we may use numbers or date instances but no date strings.

I think simple Date.parse would suffice to interpret strings.

Why:

I'm using camo (with my neat hack) in a browser (via my own REST client for camo) and after serializing/deserializing JSON objects, all Date fields become ISO date strings on the backend.

The workaround is to:
Date.prototype.toJSON = Date.prototype.getTime in the browser.

but I would like to leave Date.prototype.toJSON untouched and allow the camo validators to convert those date strings to Date objects.

@scottwrobinson
Copy link
Owner

Adding this to the todo list.

Thanks!

@royaltm
Copy link
Author

royaltm commented Feb 24, 2016

Thanks!

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

No branches or pull requests

2 participants