Skip to content

Instantly share code, notes, and snippets.

@JWPapi
Last active June 20, 2016 09:03
Show Gist options
  • Save JWPapi/943e35cc263b497154d9c5735d45740d to your computer and use it in GitHub Desktop.
Save JWPapi/943e35cc263b497154d9c5735d45740d to your computer and use it in GitHub Desktop.
Fetch.js
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