cube icon indicating copy to clipboard operation
cube copied to clipboard

Timezone conversion not working for all the timezone which have minutes ( eg: Asia/Kolkata : +5:30)

Open manickaws opened this issue 4 years ago • 3 comments

There is time conversion issue when you use SQL_UTILS.convertTz() to convert a datetime to a different time zone. The issue arises only when there are minutes in the GMT. Eg: When the datetime is converted to Asia/Kolkata time zone (+05:30) there is a mistake in the calculation where as if the GMT doesn't have any minutes as in Asia/Dubai(+04:00) or Asia/Singapore( +08:00)

To reproduce declare two members/dimension in the cube . One will be a direct column representing datetime and the second member will be using the SQL_UTILS.convertTz() on the column

The expected Behaviour should be 1) first member should display the same value as stored in the database and the second member should display the time zone converted value. for eg: if db stored value is 12 AM, then while converted to Indian time zone , the value displayed should be 5:30 AM

But the actual behaviour is , the second member add approximately 35 hours to the time stored in the db

Video attached

https://user-images.githubusercontent.com/61773643/147718930-1f9caa54-410a-494d-a33c-55979664e866.mp4

manickaws avatar Dec 30 '21 03:12 manickaws

Hey @manickaws ! SQL_UTILS.convertTz() should not be used within the time dime dimension definition. Please see https://cube.dev/docs/schema/reference/cube#convert-tz.

paveltiunov avatar Jan 04 '22 05:01 paveltiunov

Hi @paveltiunov , I didnt add the SQL_UTILS.convertTz() in the time dimension. I added in the dimension definition of the cube. Please see the attached screenshot below: The issue only comes when the timezone has minutes eg:(+05:30) where as time zone for dubai or singapore doesnt have minutes and it works fine (eg: +04:00) image

manickaws avatar Jan 04 '22 06:01 manickaws

@manickaws Could you please share the query you send to the Cube API?

paveltiunov avatar Jan 14 '22 07:01 paveltiunov