Fix mapillary links

This commit is contained in:
Pieter Vander Vennet 2021-10-16 18:30:24 +02:00
parent a2aa26aafc
commit 7566a6d046
4 changed files with 19 additions and 13 deletions

View file

@ -481,5 +481,16 @@ export class Utils {
}, false);
}
public static OsmChaLinkFor(daysInThePast, theme = undefined) : string {
const now = new Date()
const lastWeek = new Date(now.getTime() - daysInThePast * 24 * 60 * 60 * 1000)
const date = lastWeek.getFullYear() + "-" + Utils.TwoDigits(lastWeek.getMonth() + 1) + "-" + Utils.TwoDigits(lastWeek.getDate())
let osmcha_link = `{"date__gte":[{"label":"${date}","value":"${date}"}],"editor":[{"label":"mapcomplete","value":"mapcomplete"}]}`
if(theme !== undefined){
osmcha_link = osmcha_link + "," + `{"comment":[{"label":"#${theme}","value":"#${theme}"}]`
}
return "https://osmcha.org/?filters="+ encodeURIComponent(osmcha_link)
}
}