I have a React/Redux application.
I am fetching a set of "notes" from a Firebase Realtime Database. The "notes" has a Unix epoch timestamp "timestamp" stored in UTC time zone. I want the user to see all times in local time zone. Upon fetch I need to adjust the "timestamp" to reflect the users time zone.
I am creating db subscriptions to update notes in the store.
What would the best approach to adjust the UTC timezone to the users local time? I guess I first need to fetch the users settings and then adjust the "timestamp" on the fly?
My notes object
{
title: "now",
timestamp: "161651792000"
}
My user object
{
displayName: "Mickey",
userTz: "Europe\Stockholm",
"userGmtOffset":3600"
}
Db subscription code
database.ref(`${dbPathAccess}/${uid}`).on('value', (myNoteAccessSnaps) => {
...
}
Many thanks! /K