[ 
https://issues.apache.org/jira/browse/OFBIZ-5608?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13982923#comment-13982923
 ] 

Gareth Carter commented on OFBIZ-5608:
--------------------------------------

The java.sql.Date has no beginning or end as described by the API documentation:

public int getHours()
Deprecated. 
This method is deprecated and should not be used because SQL Date values do not 
have a time component.

My patch doesnt assume that, it removes the code in Ofbiz to convert it to 
another timezone to be displayed to the end
user based on their preference. 
Applying the local timezone offset is done within java.util.Date and is out of 
our control - again 
the only reason this is done is to normalize the millisecond value to local 
time. 2014-01-01 00:00:00 will have different
millisecond values in UK and in France

The point is, you cannot accurately apply a timezone to java.sql.Date because 
it doesnt have a time. Ofbiz is currently applying
the user preference timezone which will display incorrectly when the offset of 
the user preference is lower (greater negative offset) 
than the local timezone (local timezone never changes in ofbiz).

If you had 2 ofbiz servers pointing to the same database but are in different 
timezones, the birth date field will display differetly
on each server depending on your user pref.

Ofbiz1 is in UK
Ofbiz2 is in GMT-4
User Pref is GMT-3

Date from database: 2014-01-01 (00:00:00)
    UK milliseconds     = 1388534400000
    GMT-4 milliseconds  = 1388548800000
    
Applying timezone GMT-3 from UK yields 2013-12-31 (21:00:00)
Applying timezone GMT-3 from GMT-4 yields 2014-01-01 (01:00:00)

Which one is correct?

If you really think this is wrong, close this jira as won't fix and we'll just 
apply as a local patch.

> Dates Displaying Incorrectly With Negative Offest Timezones.
> ------------------------------------------------------------
>
>                 Key: OFBIZ-5608
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5608
>             Project: OFBiz
>          Issue Type: Bug
>          Components: ALL COMPONENTS
>    Affects Versions: SVN trunk, Release Branch 12.04, Release Branch 13.07
>            Reporter: Rupert Howell
>            Priority: Minor
>             Fix For: SVN trunk
>
>         Attachments: ObjectTypeTests.patch, dates.patch, dates_1589040.patch
>
>
> Dates are displaying incorrectly when negative offset (relative to UTC) are 
> applied by the users settings.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to