U4-2195 - Storing a Date on a Label property, day/month flipped after Publish in UI (US)

Created by Tom Fulton 07 May 2013, 04:38:51 Updated by Shannon Deminick 26 Jun 2017, 05:41:32

I'm using ContentService to save a DateTime value on a Label property, like so: contentService.SetValue("someLabelProp", DateTime.Now)

When I access initially via ContentService or IPublishedContent, it works just fine. However, if I Save/Publish the node in the Umbraco UI (not ContentService), I get the following:

From ContentService.GetValue -> 5/6/2013 9:58:43 PM // correct From Model.Content.GetPropertyValue -> 6/5/2013 9:58:43 PM // m/d is flipped (I'm in the US) This doesn't seem to happen if I use a Date Picker instead of a Label, but I want to use a Label as the field is informational and should be read only. Note, I did create a new Label datatype using "date" as the storage type, as ContentService gives you an error saving otherwise.

Digging deeper:

  • Both the Date Picker and Label show the same value/format in the dataDate field in the database in the formatting: 2013-05-06 21:58:43.000

  • When I use SetValue and SaveAndPublish via the ContentService, the umbraco.config shows some inconsistencies: 2013-05-06T22:21:54 5/6/2013 10:21:54 PM ... but all still works fine from both APIs.

  • Visiting the node in the Umbraco UI, the Label shows this: 06/05/2013 22:21:54 (dates flipped)

  • If I Save/Publish from the UI, the month/days are now flipped in umbraco.config: 2013-05-06T00:00:00 06/05/2013 22:21:54

There's some sample code attached you can just paste into a template.

Side note: I get even weirder results when trying this with a Textstring (backed by Date storage) instead of a Label - the dates are fine in the DB but the XML Cache has no value for the textstring date initially. After publishing in the UI it gets the string with the flipped months/days.

Screencast: http://www.screenr.com/DLV7

Comments

Shannon Deminick 26 Jun 2017, 05:41:32

Closing issue due to inactivity - see blog post for details https://umbraco.com/blog/issue-tracker-cleanup/


Priority: Normal

Type: Bug

State: Closed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 6.1.0

Due in version:

Sprint:

Story Points:

Cycle: