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

Issue with DeSerialization of Date #4696

Closed
ronak1009 opened this issue Jun 19, 2017 · 3 comments
Closed

Issue with DeSerialization of Date #4696

ronak1009 opened this issue Jun 19, 2017 · 3 comments

Comments

@ronak1009
Copy link
Contributor

ronak1009 commented Jun 19, 2017

var x = "1497810600000" //string casted timestamp
then, new Date(X) --> Invalid date.

The constructor of Date Object allows string input for long form of date only and not timestamp.
Can we update the deserialize function in Polymer.Base (probably in _deserializeValue () method of property-accessors.html) with following:

case 'Date':
var serialized;
        if(value instanceof Date) {
            serialized = Polymer.Base.deserialize(value, 'Date').getTime();
        } else {
            value = isNaN(value) ? value : Number(value);
            serialized = new Date(value).getTime();
        }
break;

@sorvell
Copy link
Contributor

sorvell commented Jun 20, 2017

Seems reasonable. Would you be willing to make a pull request? Thanks!

@ronak1009
Copy link
Contributor Author

Sure.

@ronak1009
Copy link
Contributor Author

@sorvell added the test cases

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