[Git][reproducible-builds/reproducible-website][master] 2 commits: Remove JavaScript example for fixed timezone
Chris Lamb (@lamby)
gitlab at salsa.debian.org
Tue May 13 16:39:27 UTC 2025
Chris Lamb pushed to branch master at Reproducible Builds / reproducible-website
Commits:
1e62a6b4 by Sebastian Davids at 2025-05-13T14:59:22+02:00
Remove JavaScript example for fixed timezone
Signed-off-by: Sebastian Davids <sdavids at gmx.de>
- - - - -
35b120b7 by Sebastian Davids at 2025-05-13T14:59:24+02:00
Fix CoffeeScript example
Signed-off-by: Sebastian Davids <sdavids at gmx.de>
- - - - -
1 changed file:
- _docs/source-date-epoch.md
Changes:
=====================================
_docs/source-date-epoch.md
=====================================
@@ -374,30 +374,20 @@ 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"]);
const timestamp = Number.isInteger(epoch) ? new Date(epoch * 1000) : new Date();
-
-// Alternatively, to ensure a fixed timezone:
-
-const epoch = Number(process.env["SOURCE_DATE_EPOCH"]);
-var timestamp = new Date();
-if (Number.isInteger(epoch)) {
- timestamp = new Date((epoch * 1000) + (timestamp.getTimezoneOffset() * 60000));
-}
```
-### Coffeescript
+### CoffeeScript
```coffeescript
-now = new Date()
-if process.env.SOURCE_DATE_EPOCH
- now = new Date((process.env.SOURCE_DATE_EPOCH * 1000) + (now.getTimezoneOffset() * 60000))
+epoch = Number(process.env["SOURCE_DATE_EPOCH"])
+timestamp = if Number.isInteger(epoch) then new Date(epoch * 1000) else new Date()
```
-
### Ruby
```ruby
View it on GitLab: https://salsa.debian.org/reproducible-builds/reproducible-website/-/compare/b58115fbba4f818e23215dbbe6419e2db108b8ef...35b120b727bbea979abc5c6c3e67b1acba5f05fe
--
View it on GitLab: https://salsa.debian.org/reproducible-builds/reproducible-website/-/compare/b58115fbba4f818e23215dbbe6419e2db108b8ef...35b120b727bbea979abc5c6c3e67b1acba5f05fe
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/20250513/f697b913/attachment.htm>
More information about the rb-commits
mailing list