alfresco-ng2-components icon indicating copy to clipboard operation
alfresco-ng2-components copied to clipboard

Alfresco Property 'd:date' Display Impacted by Timezone

Open bmlong137 opened this issue 3 years ago • 3 comments

  • [ ] New feature request
  • [X] Bug
  • [ ] Support request
  • [ ] Documentation

Current behaviour: The adf-content-metadata-card is displaying property type "d:date" (as opposed to "d:datetime") with timezone consideration. In the Alfresco. it uses the java.util.Date object which serializes the time and includes it in the JSON to ADW. So it is a problem only because both ACS and ADW treat dates as date/times.

So in timezones west of GMT, it shows as the previous date in the interface.

Expected behavior: Unless ACS fixes their REST interface to serialize 'd:date' as a date without a time/timezone, ADW needs to treat 'd:date' as a date without timezone consideration.

Steps to reproduce the issue: OS must be configured to think it is west of GMT. Create a custom model with a property of the 'd:date' type. Or reuse the OOTB 'cm:modelPublishedDate' property from the dictionary model definition. Set the property on a node. In the interface, select the record, open the details view, and look at the display of the property. It will show the previous date.

Component name and version: adf-content-metadata-card

Browser and version: Data formatting logic issue; not a browser issue

Node version (for build issues):
v12.22.5

bmlong137 avatar Jan 25 '22 14:01 bmlong137

This might be resolved by: https://github.com/Alfresco/alfresco-ng2-components/commit/8a9a9a6fd (unconfirmed)

bmlong137 avatar Apr 19 '22 19:04 bmlong137

It is not resolved. An ACS "d:date" (not "d:datetime") is being treated as a time with a timezone. Dates and date/times are fundamentally different types and a date should not be cast to a date/time. A date of "May 10, 2022" is not "May 10, 2022 at midnight", because then someone west of GMT will see it as "May 9, 2022".

bmlong137 avatar May 11 '22 02:05 bmlong137

Ok, it seems that "d:date" and "d:datetime" are both database TIMESTAMP values with timezones. Which is rather crazy, because now I see no point in "d:date". It should be more like a SQL "DATE" or Java LocalDate. But since it isn't in Alfresco, I guess this isn't a bug in ADF. Though it would be nice if ADF recognized the type with a model query and treated "d:date" more like an un-timed date.

bmlong137 avatar Jun 27 '22 18:06 bmlong137