Invalid date showing when using a FieldValue instead of a DateTimeField


We came across this bug lately where we had a EditModePanel in Display using a FieldValue to show the value of a DateTimeField and the time was always incorrect : it was off 4 hours (could be the GMT time but our Regional Settings are set to -5 with DST and I think that would make it at -6 right now).

 

It was fine in Edit mode as we were using the correct DateTimeField but we couldn't find out why so it wasn't as good in Display.  We ended up reverting to a DateTimeField in Display and the time was shown correctly.  We had a similar case later on with the FieldValue where the XSLT applied on it was showing the day before on the date.

 

So basically, if you are using a FieldValue to render a DateTime (maybe some other field type) and your value's invalid, go back to its complete type.

 

Maxime

Skip to main content