Closed ghost closed 4 years ago
The issue can be replicated on the dev server but not locally - I expect the timestamp is persisted in the back-end, at server time, which would explain the offset.
I don't think we really want to handle any timezone information here (especially since there is no real native Javascript to do so, and we definitely do not / nor want to collect user timezones).
One solution would be to simply send the local Date() when calling PUT on a model, so the back-end would just use that instead of persisting a local date/time in the back-end, as long as the current format is maintained.
@mena-bosch I think the backend should persist everything in it's own timezone (which hopefully is UTC). In the UI, the timezone can just be displayed, to make it clear that the displayed time does not necessarily match the user's timezone.
@mena-bosch I think the backend should persist everything in it's own timezone (which hopefully is UTC). In the UI, the timezone can just be displayed, to make it clear that the displayed time does not necessarily match the user's timezone.
While I agree this could be a solution, I am not sure yet how the timestamps for comments are persisted. If they are just stored as local date/times, then there would be some inconsistencies when presenting newly generated timestamps vs old ones. Another thing to investigate (which I haven't yet) is how the comments are sorted (back-end? front-end? by date/time or lexicographically by formatted date/time?).
Of course, the easiest workaround would be to just append " server time" to all formatted timestamps at UI level, which is not something I'd be against to be honest.
As discussed aside, will go with the most trivial option and just specify "server time" next to the comment date/time in the UI. This is a much under-utilized feature for now, so it makes little sense to invest much in refactoring.
On a side-note: weird that the date/time is, in fact, conveyed by the UI (see detailsController.js), yet it still manages to be off. Probably the UI field is ignored by the back-end.
the time is one hour off in the Vorto model comments.