Skip to content

Instantly share code, notes, and snippets.

@vialyx
Created September 17, 2018 16:40
Show Gist options
  • Save vialyx/61143e2662b36f38ed93b5b0b61431d4 to your computer and use it in GitHub Desktop.
Save vialyx/61143e2662b36f38ed93b5b0b61431d4 to your computer and use it in GitHub Desktop.
let startOfDay = Calendar.current.startOfDay(for: Date())
let dateInterval = DateInterval(start: startOfDay, duration: 8 * 60 * 60)
let meetingDate = startOfDay + 13 * 60 * 60
print("Are we have a meeting today?: \(dateInterval.contains(meetingDate))")
// Are we have a meeting today?: false
// Yeah! Today a good day for productive work without meetings!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment