[Git][reproducible-builds/reproducible-website][master] Also update the timezone snippet for Node.js / SOURCE_DATE_EPOCH.

Chris Lamb (@lamby) gitlab at salsa.debian.org
Mon May 12 18:18:07 UTC 2025



Chris Lamb pushed to branch master at Reproducible Builds / reproducible-website


Commits:
0a41c934 by Chris Lamb at 2025-05-12T11:17:44-07:00
Also update the timezone snippet for Node.js / SOURCE_DATE_EPOCH.

- - - - -


1 changed file:

- _docs/source-date-epoch.md


Changes:

=====================================
_docs/source-date-epoch.md
=====================================
@@ -374,7 +374,7 @@ def buildDate = System.getenv("SOURCE_DATE_EPOCH") == null ?
   new java.util.Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH")))
 ```
 
-### Javascript / node.js
+### Javascript / Node.js
 
 ```javascript
 const epoch = Number(process.env["SOURCE_DATE_EPOCH"]);
@@ -382,9 +382,10 @@ const timestamp = Number.isInteger(epoch) ? new Date(epoch * 1000) : new Date();
 
 // Alternatively, to ensure a fixed timezone:
 
-var now = new Date();
-if (process.env.SOURCE_DATE_EPOCH) {
-  now = new Date((process.env.SOURCE_DATE_EPOCH * 1000) + (now.getTimezoneOffset() * 60000));
+const epoch = Number(process.env["SOURCE_DATE_EPOCH"]);
+var timestamp = new Date();
+if (Number.isInteger(epoch)) {
+    timestamp = new Date((epoch * 1000) + (timestamp.getTimezoneOffset() * 60000));
 }
 ```
 



View it on GitLab: https://salsa.debian.org/reproducible-builds/reproducible-website/-/commit/0a41c93486606f6961bd98215bd0a7e620fb4eeb

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/reproducible-website/-/commit/0a41c93486606f6961bd98215bd0a7e620fb4eeb
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20250512/62da6645/attachment.htm>


More information about the rb-commits mailing list