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

[FIX] use UTC date for build timestamp #711

Open
wants to merge 1 commit into
base: v2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/tasks/replaceBuildtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ function pad(v) {
}
function getTimestamp() {
const date = new Date();
const year = date.getFullYear();
const month = pad(date.getMonth() + 1);
const day = pad(date.getDate());
const hours = pad(date.getHours());
const minutes = pad(date.getMinutes());
const year = date.getUTCFullYear();
const month = pad(date.getUTCMonth() + 1);
const day = pad(date.getUTCDate());
const hours = pad(date.getUTCHours());
const minutes = pad(date.getUTCMinutes());
// yyyyMMdd-HHmm
return year + month + day + "-" + hours + minutes;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
* Some fancy copyright
*/
// replacement of $\{buildtime\} is only made in sap/ui/Global.js and Global-dbg.js
console.log('20220620-1630');
console.log('20220620-1430');
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*!
* Some fancy copyright
*/
console.log("20220620-1630");
console.log("20220620-1430");
10 changes: 5 additions & 5 deletions test/lib/builder/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -863,11 +863,11 @@ test.serial("Build library.coreBuildtime: replaceBuildtime", (t) => {
const expectedPath = path.join("test", "expected", "build", "sap.ui.core-buildtime", "dest");

const dateStubs = [
sinon.stub(Date.prototype, "getFullYear").returns(2022),
sinon.stub(Date.prototype, "getMonth").returns(5),
sinon.stub(Date.prototype, "getDate").returns(20),
sinon.stub(Date.prototype, "getHours").returns(16),
sinon.stub(Date.prototype, "getMinutes").returns(30),
sinon.stub(Date.prototype, "getUTCFullYear").returns(2022),
sinon.stub(Date.prototype, "getUTCMonth").returns(5),
sinon.stub(Date.prototype, "getUTCDate").returns(20),
sinon.stub(Date.prototype, "getUTCHours").returns(14),
sinon.stub(Date.prototype, "getUTCMinutes").returns(30),
];

return builder.build({
Expand Down