2
Vote

DateTime XmlConvert Issue When Using Time Only Field (and Javascript error also on Time Only Field)

description

In the event you are using a Time Only field, the following file:

Orchard.ContentManagement.FieldStorage.SimpleFieldStorate

On line 29 where it is using the special case for DateTime fails when the Date part is not set (defaults to something in 1980). The date is not set if you use it as a Time Only field.

Also, when the field is a Time Only field then it throws a javascript error and doesn't show the time picker.

I may be able to come up with a fix in a week, but wanted to get it posted.

comments

orlandow wrote Dec 19, 2012 at 10:30 PM

It doesn't work when using DateOnly.

Is there a workaround?

orlandow wrote Dec 19, 2012 at 10:47 PM

sorry, it seems mine is a different issue:

in DateTimeFieldDriver.cs this line:

context.ImportAttribute(GetPrefix(field, part), "Value", v => field.Storage.Set(null, XmlConvert.ToDateTime(v, XmlDateTimeSerializationMode.Utc)));

should be

context.ImportAttribute(GetPrefix(field, part), "DateTime", v => field.Storage.Set(null, XmlConvert.ToDateTime(v, XmlDateTimeSerializationMode.Utc)));

It fixed my issue...

I'm new to all this and I don't know how to make pull requests, sorry.