Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tomorrow's calendar #5

Open
bananapunk opened this issue Nov 28, 2018 · 3 comments
Open

tomorrow's calendar #5

bananapunk opened this issue Nov 28, 2018 · 3 comments

Comments

@bananapunk
Copy link

Not really an issue but a request for a feature. What would I have to modify to sync today's AND tomorrow's calendar events? I usually check calendar before going to bed, in case I got meetings early in the morning.

@thepollara
Copy link

+1
I'd love to see the full week even

@tobiasosDev
Copy link

tobiasosDev commented Jan 17, 2019

@thepollara I made it like this. So this syncs a whole week.
@bananapunk of you just wanna today and tomorrow just replace the "+ 7" with "+ 1"

At row 22 i added:

  // we'll be looking at syncing events for today
  var today = new Date()
  var endDate = new Date()
  endDate.setDate(today.getDate() + 7)
  // Uncomment following line if you want to test this script for a day in the future
  // today.setDate(today.getDate() + 1)

  var gSuiteEvents = gSuiteCalendar.getEvents(today, endDate)

And the function markOldEvents looks like this:

function markOldEvents(row, oldEvents, sheet, index) {
  var today = new Date()
  var now = today.getTime()

  // Uncomment following line if you want to test this script for a day in the future
  // today.setDate(today.getDate() + 1)

  var storedDay = new Date(row[3])

  // if the current event doesn't match today's date, then mark it for deletion
  if (storedDay.getTime() < now) {
    // to avoid marking the same row number multiple times we first check for it
    if (oldEvents.indexOf(index+1) == -1) {
      oldEvents.push(index+1)
    }
  }
}

@sanghunka
Copy link

@tobiasosDev You are the best

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants