[CSHARP-261] JsonReader fails on some forms of Date expressions Created: 05/Jul/11  Updated: 02/Apr/15  Resolved: 08/Jul/11

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: 1.1
Fix Version/s: 1.2

Type: Bug Priority: Major - P3
Reporter: Robert Stam Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Here are some examples of JSON documents that JsonReader fails to parse:

{ date: Date() } { date: new Date() } { date: new Date("2011-01-01") } { date: Date("2011-01-01") } { date: new Date(2011,0,1) } { date: Date(2011,0,1) }

There may be others...

While these forms would never be output by JsonWriter and are also not strictly JSON, they are commonly used and it would be helpful to support them.



 Comments   
Comment by Robert Stam [ 31/Aug/11 ]

That's how the Date constructor works in JavaScript when called without "new". I know it's crazy, but that's how JavaScript defines it!

Comment by Ishaan [ 31/Aug/11 ]

Just tested this against the latest master.
While

{key: new Date()}

sets key value to the current timestamp (ok), parsing for

{key: Date()}

sets key to a string value (not ok)

Generated at Wed Feb 07 21:36:18 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.