Skip to content
This repository has been archived by the owner on Jan 23, 2024. It is now read-only.

DateTime lost after executeOnServer #11

Open
rnikitin opened this issue Dec 5, 2012 · 5 comments
Open

DateTime lost after executeOnServer #11

rnikitin opened this issue Dec 5, 2012 · 5 comments

Comments

@rnikitin
Copy link

rnikitin commented Dec 5, 2012

I tried to work with Model, containing Data.

The format I received from server with first request: /Date(1354656075282)/"}
While executing it sends with correct format.
But when it returned back from server side: /Date(-62135596800000)/

I cheched with debugger - on server side the field already lost.
So, it could be a problem somewhere in KnockoutUtilities.ConvertData.

Could somebody reproduce this issue?

BTW, please send to NuGet fresh version of the library :)

@AndreyAkinshin
Copy link
Owner

Hi, rnikitin.

Now best way to use Date with JSON is use string in model and parse it on server. But I'll try to study your problem more closely.
The new NuGet-package will be soon.

@rnikitin
Copy link
Author

rnikitin commented Dec 6, 2012

That looks a way I fixes this, but I used an int to store milliseconds.

BTW, found, that Serialization and Deserialization pretty slow and with 20-30 entities it took about 1 second to serialize -> deserialize -> serialize to client again.

Tried to replace this serialization to Json.Net - no luck. I think, that ConvertData, which uses reflections, isn't too fast.
Is there any way to rewrite it or to throw it away?

@AndreyAkinshin
Copy link
Owner

Hmm... Ok, I will research this question.

@TecNic
Copy link

TecNic commented Sep 30, 2013

it's not an issue with KnockoutUtilities but a javascript one.
as Andrey said, the best way to avoid this is to convert it to string

@rnikitin
Copy link
Author

Anyway the best way is to use proper serializer/deserializer like json.NET.

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

No branches or pull requests

3 participants