) Server sends all DateTimeStamps as Unix epoch time
) Browser JS client converts to local time where user is located
) added bonus: epoch time is very compact
Here's an example function for the client side, which is simple and readable, but could easily be made to contain more detail:
const get_DayHourMin = (epoch_secs) => { // example of return val: Thu 1:45p
const date_str = `${new Date(epoch_secs * 1000)}`
const timestamp_ary = date_str.match(/^(\w{3}).+(\d\d)
![:(](https://www.bridgebase.com/forums/public/style_emoticons/default/sad.gif)
const day = timestamp_ary[1]
let hour = Number(timestamp_ary[2])
let min = timestamp_ary[3]
if (hour > 12) { // make 24hr time 12hr time
hour -= 12
min += "p" // p.m.
}
else { min += "a" } // a.m.
return `${day} ${hour}:${min}`
}
In general, I think y'all's site is amazing, and I play way to much online bridge. I've borrowed a bunch of ideas from you for my site word game site -- https://lexluv.com -- especially the concept of a new user session causing the previous client to shut down. BTW, you should also investigate push notifications...
Cheers!