Umbraco-CMS: Invalid date returned from `contentResource.getById`

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

10.2.1

Bug summary

When I use contentResource.getById() I get document incl. tabs and properties. However for some

image

but the endpoint GetById does return a valid date. image

Specifics

No response

Steps to reproduce

Request different documents usings contentResource.getById. Depending on the date, some of these are returned as invalid date from angular resource.

In this case date is 11/20/2022 12:00:00 AM which was picked from a date picker and property editor afterwards changed to label, which is shown on the content node. I should also be mentioned that I afterwards changed datatype of the property from date picker to label (datetime), so the nodes which has been saved afterwards may store the value in a different format.

image

Expected result / actual result

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 22 (22 by maintainers)

Most upvoted comments

Hi @elit0451

I have made a nice dashboard for you using default starter kit 😁 Just extract this to App_Plugins folder: MyDashboard.zip

On Home Page node I have added this properties using Date Picker with default configuration. image

image

Next on Home Page node set December 1st 2022 as start date (v11 release date! đŸŽ‰đŸ„ł)

image

In dashboard it should show this clicking the “Show details” button.

https://user-images.githubusercontent.com/2919859/204396292-cce5a41f-ecb6-4307-bf26-8b0c80e899e9.mp4

Start Date and End Date properties are included, but only End Date is formatted.

If I then change End Date property to using “Label (datetime)” instead.

image

then I get this - notice start and end dates hasn’t changed, but end date is formatted as 01/20/2012

https://user-images.githubusercontent.com/2919859/204397096-17ef0f80-92a1-4c6e-a054-b7b3a860ee62.mp4

The locale is en-US but even before formatting date it log the content node, which property value is 01/20/2012:

image

even though the date stored in database and returned from GetById API method is 12/1/2022 12:00:00 AM: image

Hi @elit0451

It just used the standard datatype instance “Date Picker”.

image

Afterwards I changed the property editor to “Label (datetime)” as these data will be imported via a Hangfire job, so using the date picker was mainly to set a data and get a value in the property, but I think it shouldn’t matter as the value returned from the endpoint looks correct.

Furthermore no content types or properties vary by culture, but we have these languages. We could delete en-US but I recall Deploy will re-create this anyway each time a new environment is created on Umbraco Cloud.

image