Skip to content

Issue with DeSerialization of Date #4696

@ronak1009

Description

@ronak1009

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;

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions