Conversation
5e658f1 to
55e2934
Compare
Klakurka
left a comment
There was a problem hiding this comment.
If I change my account's time zone, the dashboard doesn't update to reflect the fact that txs made on a certain date in one time zone are actually a day ahead/behind in another.
I was not clearing cache after setting the timezone, now It should work |
b2f446f to
05289ae
Compare
chedieck
left a comment
There was a problem hiding this comment.
Requested some changes in the code, also:
The other settings (Preferred currency & organization) give us feedback when they're updated. This could do the same as preferred currency, showing "Updated timezone successfully" after the update, or the error in case there is some.
pages/payments/index.tsx
Outdated
| user, | ||
| userId | ||
| userId, | ||
| userProfile: user.userProfile |
There was a problem hiding this comment.
This seems really redundant. You're sending the samething twice, first user then user.userProfile as userProfile
redis/paymentCache.ts
Outdated
|
|
||
| export const getCachedPaymentsCountForUser = async (userId: string): Promise<number> => { | ||
| const dashboardData = await getUserDashboardData(userId) | ||
| const dashboardData = await getUserDashboardData(userId, moment.tz.guess()) |
There was a problem hiding this comment.
this doesn't seem right. It will be run in the server. I tested adding
console.log('WIP tz', moment.tz.guess(), typeof window, 'is window type')
right above this line and got
2|next | 2025-01-07T00:45:35: WIP tz Africa/Abidjan undefined is window type
... as a result, which shows:
- guess is wrong
- is being run in the server, since this was in the server logs (not the browser console) and even shows that
typeof window === undefined.
| setError('') | ||
| setSuccess('Timezone updated successfully.') | ||
| } | ||
| } catch (err: any) { |
There was a problem hiding this comment.
this should actually be at the else of the if above. If the api runs into an error, it will return a status code 500 response message, not throw here.


Related to #893
Description
Implement timezone option in user Account settings.
This PR will enable timezone option, the selector is initialized with the timezone of the user by location, once user changes the selector value it will set the timezone and it will make the dashboard data, the txs listing of each button and payments listing to use the timezone selected.
Test plan
Start the server with
docker compose up