There is an unsaved comment in progress. You will lose your changes if you continue. Are you sure you want to reopen the work item?
Date Time Field Saving and Retrieving Different Results
There are two issues here, 1 which has a fix and the other I don't know how to fix.
When I use the Orchard Date Time field it can be added but then the field does not re-appear for that content type. I have isolated this (to what I believe) is the error in that since 1.6 the field.DateTime Kind is stored as DateTimeKind of Local. This causes
an error on Displaying (or editing again) because it cannot use "ConvertTimeFromUtc" with a DateTimeKind of Local. Here is some code that takes care of the issue (not sure if it is the best fix though):
value = DateTime.SpecifyKind(value, DateTimeKind.Unspecified);
On to the second issue. I cannot understand why when I enter a date/time it is returned on display in a different date/time. I have stepped through the code for over two hours and all I know is that I don't understand how TimeZoneInfo.ConvertTimeFromUtc and
TimeZoneInfo.ConvertTimeToUtc work / were intended to work here in Orchard. The concept seems great, the user enters a time in the field and it gets converted to UTC. Then, when retrieved, it gets converted back from UTC. However, what I enter in is not what
I get back. I have messed around with the default time zone settings in the main settings area and that simply causes the time to shift one way or the other, doesn't actually fix the problem.