Difference between revisions of "Talk:Freedom Falls Timekeeping (Proposed)"
From AiteRP Wiki
(Created page with "== Script == The following node.js script is used to calculate skip-dates let dateformat = require('dateformat'); const DAY = 1000 * 60 * 60 * 24; if (process.argv.l...") |
m (→Script) |
||
Line 1: | Line 1: | ||
== Script == | == Script == | ||
− | The following node.js script is used to calculate skip-dates | + | The following node.js script is used to calculate skip-dates. It depends on the <code>dateformat</code> module. |
let dateformat = require('dateformat'); | let dateformat = require('dateformat'); | ||
Line 27: | Line 27: | ||
node . 25 32 October 24, 2185 | node . 25 32 October 24, 2185 | ||
+ | |||
+ | [[User:Gisle|Gisle]] ([[User talk:Gisle|talk]]) 11:02, 5 December 2016 (CET) |
Latest revision as of 10:02, 5 December 2016
Script
The following node.js script is used to calculate skip-dates. It depends on the dateformat
module.
let dateformat = require('dateformat'); const DAY = 1000 * 60 * 60 * 24; if (process.argv.length < 5) { console.error("skipdates <skip> <count> <date...>"); process.exit(1); } let skip = parseInt(process.argv[2]) * DAY; let count = parseInt(process.argv[3]); let date = new Date(dateformat(process.argv.slice(4).join(' '))); if(Number.isNaN(count) || Number.isNaN(skip)) { console.error('<skip> and <count> has to be numbers.') process.exit(1); } for(let i = 1; i <= count; ++i) { let skipDate = new Date((date - 0) + (skip * i)); console.log(dateformat(skipDate, "mmmm d, yyyy (dddd)")); }
The command ran to generate the list on the page is. Change 32
for another number to generate more or fewer dates.
node . 25 32 October 24, 2185