Skip to content
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

[FEATURE] versionInfo: Use UTC Timestamp #348

Open
wants to merge 1 commit into
base: v2
Choose a base branch
from

Conversation

RandomByte
Copy link
Member

@RandomByte RandomByte commented Oct 10, 2019

No description provided.

@matz3
Copy link
Member

matz3 commented Oct 14, 2019

@RandomByte the issue is related to the cachebuster but the code changes are for the version info. So I'm a bit confused 😕

@RandomByte RandomByte force-pushed the version-info-utc-timestamp branch from 0d3b58a to 660a83e Compare October 23, 2019 10:59
@RandomByte
Copy link
Member Author

Removed the reference to https://github.com/SAP/ui5-builder/issues/347 as it is actually unrelated.

Still to be checked: Does the technical info dialog expect UTC or the user timezone?

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 90.178% when pulling 660a83e on version-info-utc-timestamp into 829134b on master.

@codeworrior
Copy link
Member

For the technical info dialog, buildtimestamp is a string. It does not try to parse or interpret it.

@RandomByte
Copy link
Member Author

In that case I guess it is an improvement to use the UTC time here. Should we append a "UTC" string to the end of it?

@codeworrior
Copy link
Member

That we have to check against the runtime, first. I don't remember where the cache buster takes the timestamp from. But AFAIK some code makes assumptions about the format of the timestamp. A trailing 'UTC' or 'Z' might confuse such code.

Most likely, it is taken from a different location. And definitely, the ui5 tooling is not responsible yet for the cachebuster token of the CDN installation. But if the version.json is the source for the runtime I would keep the syntax of the timestamp aligned.

@RandomByte
Copy link
Member Author

So this PR should be good to merge for the time being?

@codeworrior
Copy link
Member

From my POV, yes.

@matz3
Copy link
Member

matz3 commented Oct 23, 2019

For the technical info dialog, buildtimestamp is a string. It does not try to parse or interpret it.

That's not quite true, right?
But changing to UTC should be fine, although the timezone is still not clear. This should rather be solved in the runtime.

CTRL+SHIFT+ALT+S
1.70.1 (built at 2019-10-08T08:43) => via RegExp /w fallback to given string

CTRL+SHIFT+ALT+P
1.70.1 (built at 08.10.2019 08:43:00) => via DateFormat (yyyyMMdd-HHmmss)

@codeworrior
Copy link
Member

Strange. I could swear I saw a simple setProperty. But now I see

  oViewModel.setProperty("/ProductTimestamp",
     this._generateLocalizedBuildDate(oVersionInfo.buildTimestamp));

which couldn't be any clearer :-(

@codeworrior
Copy link
Member

To compensate my embarrassing fault above a bit, I tried to get a full picture now, but what I see so far doesn't look nice :-(

In the TechnicalInfo (CTRL-SHIFT-ALT P), method _generateLocalizedBuildDate does not only create a localized date, it also parses the original time stamp with a locale specific DateFormat instance. That is, it assumes a local timestamp, which will be wrong whenever server and client are not in the same TZ.

So what about the sources for the timestamps?

In the Maven build, the sap.ui.buildinfo.buildtime is filled from the maven.build.timestamp property. According to https://issues.apache.org/jira/browse/MNG-5452 , Maven since version 3.2.2 uses UTC for its timestamp. In older versions, it used local time of the Java VM. I've checked some of the existing release log files, they all used Maven 3.0.5 for the recent patch releases (which implies that timestamps are in local time of the server / Java VM).

For the sap-ui-version.json in our delivery, the same seems to apply. The Maven tooling creates a timestamp with local time (using standard Java means, no dependency to the Maven version, AFAICS).

@codeworrior
Copy link
Member

For a full picture, the UI5 tooling is still missing (at least the placeholder replacement in Global.js, sap-ui-version.json is the topic of this PR), but that's your home-turf :-)

@tobiasso85
Copy link
Contributor

tobiasso85 commented Aug 31, 2020

For the technical info dialog, buildtimestamp is a string. It does not try to parse or interpret it.

That's not quite true, right?
But changing to UTC should be fine, although the timezone is still not clear. This should rather be solved in the runtime.

CTRL+SHIFT+ALT+S
1.70.1 (built at 2019-10-08T08:43) => via RegExp /w fallback to given string

CTRL+SHIFT+ALT+P
1.70.1 (built at 08.10.2019 08:43:00) => via DateFormat (yyyyMMdd-HHmmss)

Couldn't we use DateFormat.getDateInstance in both cases and pass the UTC: true option to it?
Since it was never correct/stable anyways (server creates with local date/client consumes with local date).

Then we could eave this change as it is.

Making it a "proper" UTC timestamp requires the TZ imho and is a different topic

Copy link
Contributor

@tobiasso85 tobiasso85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense changing it here to UTC and adapt the UI5 codebase accordingly.
Does anybody depend on this timestamp being a "local" one?

@RandomByte RandomByte removed the request for review from devtomtom November 18, 2020 12:48
@RandomByte RandomByte changed the base branch from master to v2 November 3, 2022 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants