LinqToQuerystring icon indicating copy to clipboard operation
LinqToQuerystring copied to clipboard

DateTime parse error

Open rogerfar opened this issue 10 years ago • 2 comments

When I parse my OData string with this datetime: datetime'2014-07-10T00:00:00.000'

I get an error: String was not recognized as a valid DateTime

I noticed this code in DateTimeNode.cs

        var dateText = this.Text
            .Replace("datetime'", string.Empty)
            .Replace("'", string.Empty)
            .Replace(".", ":");

The last replace makes the datetime string: 2014-07-10T00:00:00:000 but it should be 2014-07-10T00:00:00.000

When I read the OData specifications:

datetime’yyyy-mm-ddThh:mm[:ss[.fffffff]]’ NOTE: Spaces are not allowed between datetime and quoted portion. datetime is case-insensitive

I don't think there is a need to replace the . with a :, right?

rogerfar avatar Jul 10 '14 20:07 rogerfar

I think you may be right there, good spot. I'll try to get this addressed in the next week or so.

beyond-code-github avatar Jul 10 '14 21:07 beyond-code-github

@Roysvork did you manage to merge this fix in, or would you like a PR?

rogerfar avatar Jan 13 '15 18:01 rogerfar