Opened 4 years ago

Closed 4 years ago

#2215 closed defect (fixed)

Change history is logging timestamp values incorrectly

Reported by: Nicklas Nordborg Owned by: everyone
Priority: major Milestone: BASE 3.16.2
Component: core Version:
Keywords: Cc:

Description

In the "Change history logging" functionality it is possible to turn on logging the new and old values of the property that was changed. If the values are timestamps the "hour" part is logged using 12-hour format between 1 and 12. This means that only values with time part between 01:00:00 and 12:59:59 are logged correctly. Values between 00:00:00 and 00:59:59 is logged as 12:xx:xx and values between 13:00:00 and 23:59:59 are logged with 12 hours subtracted from the hour part.

The reason is that the new/old values are logged in string format and the formatter implementation for timestamps is incorrectly using a template of yyyy-MM-dd hh:mm:ss. hh outputs the hour in 12-hour format. To get the hour in 24-hour format HH must be used.

NOTE! This is something that could have gone unnoticed in other places as well so a search for this pattern in the rest of the code should also be made.

Change History (3)

comment:1 by Nicklas Nordborg, 4 years ago

In 7827:

References #2215: Change history is logging timestamp values incorrectly

comment:2 by Nicklas Nordborg, 4 years ago

In 7828:

References #2215: Change history is logging timestamp values incorrectly

Found two more places that used 'hh'. One in the test code for Excel functionality and one in the FlatFileParser when handling Excel files. I could not get them to cause any problems. It seems like Excel is smart enough to let 'hh' mean 24-hour format if no AM/PM marker is found in the template.

I also found a few unused code lines in the Values class and removed them.

comment:3 by Nicklas Nordborg, 4 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.