cube
cube copied to clipboard
The 'set' method of RedisCacheDriver saves wrong date value if a date value isn't utc timezone
Describe the bug The 'set' method of RedisCacheDriver saves a wrong date value if a date value doesn't use an utc timezone.
To Reproduce The example value: new Date('Fri Jan 01 2021 00:00:00 GMT+0900 (Korean Standard Time)') from DBMS
case 1. using LocalCacheDriver (by default) the example value is saved to new Date('Fri Jan 01 2021 00:00:00 GMT+0900 (Korean Standard Time)') by LocalCacheDriver.set - No problem
case 2. using RedisCacheDriver(by set CUBEJS_REDIS_USE_IOREDIS) the example value is saved to "2020-12-31T15:00:00.000Z" by RedisCacheDriver.set - KST timezone applied to the date string
After that, Both saved values are got by each get method. Because of different saved values, The problem occurred by transformValue function in gateway.js(@cubejs-backend/api-gateway)
case 1. using LocalCacheDriver (by default) the example value is transformed to "2021-01-01T00:00:00.000" - Correct!
case 2. using RedisCacheDriver(by set CUBEJS_REDIS_USE_IOREDIS) the example value is transformed to "2020-12-31T15:00:00.000Z" - Wrong!
Expected behavior The example value should be changed to "2021-01-01T00:00:00.000".
Screenshots
Version: @cubejs-backend/[email protected] @cubejs-backend/api-gateway0.26.35
Additional context
👋 a quick reminder that we will be replacing Redis with Cube Store as announced in this blog post.
I believe that this issue is not relevant anymore since Cube Store has replaced Redis for query queue and cache management.
Docs: https://cube.dev/docs/product/deployment#redis
Announcement: https://cube.dev/blog/how-you-win-by-using-cube-store-part-1