-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Timezone from client #303
Timezone from client #303
Conversation
This reverts commit cefe7eca24999ca3e09e8d5070f06e95e5817f16.
Following some investigation into OMERO timezones it's apparent that when OMERO.server returns a datetime to OMERO.web it's unclear what timezone it's in. Therefore we shouldn't make assumptions about whether it should be converted into a different timezone for the client of not, so default to UTC. Since this is now configurable an OMERO.web admin can change the default timezone for OMERO.web.
Requires that the dates from the backend API are in UTC
This pull request has been mentioned on Image.sc Forum. There might be relevant details there: https://forum.image.sc/t/omero-webclient-import-date-modify-timezone/54384/3 |
See comment from @stephenogg: #4 (comment) This PR is causing a test failure: because the test expects this timestamp to be rendered to this string:
which happens in tree.py
This fails because the Django setting |
8de8cdc
to
ea6e599
Compare
Currently in released If most users already have this value "incorrect" (not matching their time zone) is there anything wrong with making it configurable, with the default being Opened a PR to fix the integration test failure: ome/openmicroscopy#6284 |
I'm not adverse to having it be configurable though I do think the default should be left alone (ie. |
Hi Will- I think this is because in the omeroweb/webclient/templates/webclient/annotations/metadata_general.html file, the display dates of the projects/datasets and annotations are modified with the "data-isodate", while the import date display is from the |
Thanks @stephenogg. I fixed the image acquisition and import date display to be consistent with creation and annotation dates. |
@stephenogg All time-stamps should now behave as you describe: "The display of the dates changes when I change the timezone setting on my computer, but NOT when I change the Is this OK, or do we need an option for clients to see time-stamps according to the |
@will-moore Yes all the timestamps in the right hand-panel behave as noted above. I want to point out that timestamps that aren't in the right-hand panel, e.g., the dates displayed in the middle panel when a user clicks on the history tab, or dates displayed in the middle-panel when users are searching their data from the search function, haven't been updated to use the OME.formatDate(), and therefore display inconsistently with those dates in the right hand panel. Should that be addressed as part of this PR? To have true multi-timezone support, I think you would have to assign a "home" timezone to users, maybe as part of their profile, and then images uploaded by each user would have that home timezone collected as part of the import process. Then, the timestamp, along with the user's timezone would absolutely determine when and in which timezone the image was imported. I'm not proposing this, just saying that you need more information if you want to be deterministic. For me, having the display dates of images/datasets/objects match the time when I think I imported/created them is what's important. I think that your currently proposed behaviour (timestamp displayed in the timezone that the machine running the webclient is set to) is fine, because in most instances that will match the user's timezone. So there isn't a need to see timestamps according to the Many instances will have one webclient installed along with the omero-server in a single-node configuration and users from all timezones will connect from their local machine to the same webclient running on a remote computer. That configuration is slightly different than what I've been testing, where I'm using a webclient running on my local computer to connect to a remote omero-server running on a different machine. So unlike the test situation I've created, the timezone setting of a user's computer won't affect the timestamp display. Only the timezone setting of the machine running the webclient, I think. But I don't know enough about where the timezone information is set/stored/used to know whether this would affect the timestamp display? |
@stephenogg Thanks for the feedback. It might be a while before I do more on this - away for a couple of weeks now, but will look at the middle panel dates next... |
@will-moore That didn't take long. I haven't tested extensively, but it seems that the date displays are all now consistent. Thanks. |
Note the OMERO integration tests have been periodically failing since the inclusion of this change and will need to be adjusted accordingly. Temporarily excluding this PR until @will-moore comes back from annual leave. |
@sbesson Apologies, ome/openmicroscopy#6284 has the test changes but was being excluded. I've just fixed the build so it should be included now (and the tests should pass with this PR included, so please don't exclude this now, Thanks). |
@stephenogg Apologies for the delay. To answer your last question. |
@will-moore On merge-ci, I have, being on my Mac in Dundee, with timezone set as below, following experience Tested following timestamps in OMERO.web:
All times checked matched my wall clock and my expectations. How valuable would that be to change the timezone on my Mac and go with the tests again ? Is that necessary ? |
Re: @sbesson "by local time of the browser, assuming two clients accessing the same data on the same server via Web from two different timezones, do you mean the dates should render differently" Yes |
Changed my timezone on the Mac to Edmonton/Canada. Tried to create a new D, and also add attachment and comment. All times are now in Edmonton/Canada in OMERO.web (the times shown yesterday in UK/Dundee have indeed changed to E/Canada as well), which matches the wall clock in Edmonton/Canada and the expectation as highlighted in #303 (comment) cc @sbesson . It kind of also matches my intutive expectation. |
I think I understand now the behaviour, the obvious question is |
Partly it's been left in this PR since it was originally needed for different behaviour. |
Reviewing the pros & cons:
So the primary issue as far as I read the current state of this PR is if the server moves locations, right? I can see having that out-of-scope for this PR as long as the choices made here don't prevent us from solving the deeper issue (if we want to). |
I don't think that server moving locations should have any effect. The UTC time-stamps that it provides the webclient will be unchanged (as far as I understand). The But if you were to set the For example, I just added a comment on my local server: "UK time in browser at 11:34 on 25th August"
I guess the
When I switch the timezone on OMERO.web:
Now I see the JSON data is:
But that renders the same in my browser:
So, changing the omero-web time-zone has no effect on what users see in the webclient. |
Suggestion on 27/08 during standup:
|
Test insight: Test 1: Timezone on Mac is UK, London
Result of Test1: the times in insight and web match. They also match the wall clock in Dundee. Test 2: Timezone on Mac is Edmonton, Canada
Result of Test 2:
All the tests are as expected, all times match. |
As discussed today, it would be good to get this into a release candidate. |
This is #4 re-opened in response to user report at https://forum.image.sc/t/omero-webclient-import-date-modify-timezone/54384
Current situation (before this PR):
d.getUTCHours()
etc, so if your timezone is not UTC, the time-stamps will appear wrong (as reported above).{{ manager.dataset.getDate|date:"Y-m-d H:i:s" }}
I believe these will be formatted according to Django'sTIME_ZONE
which isEurope/London
, so anyone in a different time zone will see incorrect times.datetime.isoformat() + "Z"
. Then formatted via JavaScript withOME.formatDate()
. E.g.OME.formatDate("2021-07-09T13:29:32Z") -> "2021-07-09 13:29:32"
. This works for UK. I assume it's also broken in other time-zones.OME.formatDate()
formats to UTC. *Note: Without theZ
we get a formatted string showing an hour earlier since the date is not understood to be UK time-zone (British Summer Time), so formatting gives an hour earlier.OME.formatDate("2021-07-09T13:29:32") -> "2021-07-09 12:29:32"
.This PR:
OME.formatDate()
in JavaScript to format all dates in webclient (unless I've missed some)? This now formats date according to the browser's time zone.{{ manager.dataset.getDate|date:"r" }}
(see docs which includes time-zone offset info, although the time-stamp is UTC data from the server). E.g."2020-03-12T21:02:43+00:00"
for Europe/London (default). These are then converted to browser time-zone with JavaScriptOME.formatDate()
The intended behaviour for all time-stamps would be as described by @stephenogg below: "The display of the dates changes when I change the timezone setting on my computer, but NOT when I change the
omero.web.time_zone
setting. They all display in America/Edmonton time when the computer's timezone is set to America/Edmonton and in Europe/London time when the computer's timezone is set to Europe/London, irrespective of theomero.web.time_zone
setting.Pros / Cons to this PR:
Pros:
OME.formatDate()
so it will be consistent across the webclient.Cons:
NB: Whether you consider this is a bug-fix or a breaking change depends on whether you think the previous behaviour was a feature or a bug.