[Git][reproducible-builds/reproducible-website][master] Merge a fix for the JavaScript SOURCE_DATE_EPOCH snippet by Sebastian Davis...

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



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


Commits:
b2f00e4a by Chris Lamb at 2025-05-12T11:05:07-07:00
Merge a fix for the JavaScript SOURCE_DATE_EPOCH snippet by Sebastian Davis which does not handle non-integer value correctly. (Closes: #64)

- - - - -


1 changed file:

- _docs/source-date-epoch.md


Changes:

=====================================
_docs/source-date-epoch.md
=====================================
@@ -377,7 +377,8 @@ def buildDate = System.getenv("SOURCE_DATE_EPOCH") == null ?
 ### Javascript / node.js
 
 ```javascript
-var timestamp = new Date(process.env.SOURCE_DATE_EPOCH ? (process.env.SOURCE_DATE_EPOCH * 1000) : new Date().getTime());
+const epoch = Number(process.env["SOURCE_DATE_EPOCH"]);
+const timestamp = Number.isInteger(epoch) ? new Date(epoch * 1000) : new Date();
 
 // Alternatively, to ensure a fixed timezone:
 



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

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/reproducible-website/-/commit/b2f00e4a5dde2cc68b2eb060f991bb074a8d2c02
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/d35ebc49/attachment.htm>


More information about the rb-commits mailing list