feat: add links for osm coming events
This commit is contained in:
parent
b29dbedaf9
commit
5956637cdf
@ -3,7 +3,10 @@ import sendPostMastodon from "./libs/utils.mjs";
|
|||||||
import * as coming_events_json from './../assets/documents/agendadulibre_openstreetmap.json' assert { type: "json" };
|
import * as coming_events_json from './../assets/documents/agendadulibre_openstreetmap.json' assert { type: "json" };
|
||||||
|
|
||||||
import {getArticlesFromDaysInJson} from './libs/rss_management.mjs'
|
import {getArticlesFromDaysInJson} from './libs/rss_management.mjs'
|
||||||
|
import moment from "moment";
|
||||||
|
|
||||||
|
let event_date_format = 'dddd DD/MM HH:mm'
|
||||||
|
let event_date_format_end = 'HH:mm'
|
||||||
const days_filter = 7;
|
const days_filter = 7;
|
||||||
|
|
||||||
function makeTitleContentFromAgendaDulibre(articles) {
|
function makeTitleContentFromAgendaDulibre(articles) {
|
||||||
@ -13,11 +16,13 @@ function makeTitleContentFromAgendaDulibre(articles) {
|
|||||||
if(! articles.length ){
|
if(! articles.length ){
|
||||||
return '- Aucun évènement prévu. T_T'
|
return '- Aucun évènement prévu. T_T'
|
||||||
}
|
}
|
||||||
articles.forEach(item=>{
|
articles.forEach(event=>{
|
||||||
content += `\n* ${item.city} - ${item.title}` ;
|
let eventUrl = event.url.replace('.json', '')
|
||||||
let start = new Date(item.start_time)
|
let start = moment(new Date(event.start_time)).utcOffset(0).format(event_date_format)
|
||||||
let end = new Date(item.end_time)
|
let end = moment(new Date(event.end_time)).utcOffset(0).format(event_date_format_end)
|
||||||
content += `\n <${start} -- ${end}>` ;
|
let tags = '#'+event.tags.split(' ').join(' #')
|
||||||
|
content += `\n* [${event.city} : ${start} - ${end} | ${event.title}](${eventUrl})` ;
|
||||||
|
content += `\n ${tags}` ;
|
||||||
})
|
})
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user