Prevent errors wherever possible
Jakob Nielsen said it well in his 10 Heuristics for UI Design:
Even better than good error messages is a careful design which prevents a problem from occurring in the first place. Either eliminate error-prone conditions or check for them and present users with a confirmation option before they commit to the action.
The goal of your design is to make errors an edge case. They will happen, but you want it to be a rare occurrence.
As someone else here noted, it's good to support native calendar widgets on mobile in most cases. But if you design your own (which you'll want on desktop), make the limitation clear. You may even need some kind of hint in the UI explaining why there are no past dates.
Errors will happen
As I said above, you often can't avoid errors entirely with any component. For example, does your system append parameters to the URL to specify the date range? That's a good thing for sharing views with others, but what if the URL is followed later and the range has become invalid?
You need well-crafted error messages that are succinct enough that users won't just ignore them (how fast do you hit esc?) but descriptive enough that they know exactly what to do next.