Here’s how to do this with calendar rules.
Fair warning: the rules sets don’t work reliably. Guests were able to book in violation of my calendar rule sets. CS confirmed that my settings were correct and cancelled the two IB stays that were able to circumvent the rules in their system. CS “escalated” to tech support, but I never got word that it was fixed.
Go to your listing’s calendar.
For situation #1, click on July 16-18. In the pane on the right, scroll down to Rule Sets and click the drop down: “new rule set”.
Allow check-in on the days you’re available. Allow check-out only on the days you want. Save the rule set.
For situation #2, I don’t know about you, but many of my stays run Friday-Sunday. Requiring a stay through Monday means that weekend may not sell. What I’d do is restrict the check-in so I don’t have a back-to-back stay on Sunday. So I click on Sunday and create a rule set that does not allow check-in on Sunday.