Last active
June 20, 2016 09:03
-
-
Save JWPapi/943e35cc263b497154d9c5735d45740d to your computer and use it in GitHub Desktop.
Fetch.js
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
export default createContainer((params) => { | |
Meteor.subscribe('events'); | |
const eventlist = Events.find({}, { | |
sort: { | |
start_time: 1 | |
} | |
}).fetch().filter(event => { | |
let location = params.location; | |
let timediff = Date.parse(event.start_time) - Date.now(); | |
return (location === undefined) || location === event.location) && timediff > -(6 * 60 * 60 * 1000) && timediff < 90 * 24 * 60 * 60 * 1000}); | |
const days = _.groupBy(eventlist, eventobj => { | |
let starttime = Date.parse(eventobj.start_time); | |
return whichDay(eventobj.start_time) + " " + starttime.getUTCDate() + '.' + starttime.getUTCMonth() + 1 | |
})return {days: days};}, | |
App); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment