This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
fs.readFile("input.geojson", function(err, data) { | |
if (err) throw err; | |
let track = JSON.parse(data); | |
for (let i = 0; i < track.features[0].geometry.coordinates.length; i++) { | |
let timestamp = Date.parse(track.features[0].properties.coordTimes[i]) | |
track.features[0].geometry.coordinates[i][3] = timestamp | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mo = require('moment'); | |
function getSecondMonday(startDate) { | |
var startOfMonth = mo(startDate).utc().startOf('month').startOf('isoweek'); | |
var studyDate = mo(startDate).utc().startOf('month').startOf('isoweek').add(2, 'w'); | |
if (studyDate.month() == startOfMonth.month()) { | |
studyDate = studyDate.subtract(1, 'w'); | |
} | |
return studyDate; |