Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 330144

Summary: Grouping by quarter on Date data type is incorrect when time zone is west of OS default
Product: z_Archived Reporter: Mark Mising name <mark.mills>
Component: BIRTAssignee: xiaofeng zhang <xiaofeng.zhang>
Status: RESOLVED FIXED QA Contact: Xiaoying Gu <bluesoldier>
Severity: major    
Priority: P3 CC: bluesoldier
Version: unspecified   
Target Milestone: 3.7.0 M7   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Test case for grouping Date data by quarter none

Description Mark Mising name CLA 2010-11-12 16:17:13 EST
Build Identifier: 2.6.1.v20100902

If the run and render tasks are assigned a time zone that is west of the OS
time zone, then grouping by the BirtDateTime.quarter function on Date data is grouped into the previous quarter. This is a result of the JavaScript engine using a java.util.Date instance for the data value instead of the java.sql.Date instances in the data rows. This is a problem since the BirtDateTime.quarter function looks at the class of the value to determine whether to adjust the value by the time zone offset. Normally, this would not be done for java.sql.Date objects (as is the case when the value is formatted for display). This makes it impossible to reliably use Date type data in script functions when rendering for a time zone other than the server.

Reproducible: Always

Steps to Reproduce:
1. Open the attached report in the RCP designer
2. Preview the report (notice that there are two quarter groups)
3. Click the (Click to change Preview Preferences) link and change the time
zone to a time zone west of the OS...e.g., if the OS is on Eastern Standard
Time, change the preview preference to Pacific Standard Time)
4. Click OK and Yes to confirm refresh (notice that now April 1 was grouped into Q1 instead of Q2)
Comment 1 Mark Mising name CLA 2010-11-12 16:19:47 EST
Created attachment 183046 [details]
Test case for grouping Date data by quarter
Comment 2 xiaofeng zhang CLA 2011-05-17 04:23:44 EDT
The server time zone should not be applied to java.sql.Date object when calculating quarter. Fix this issue.