If you include the "id" attribute like id="something" in the <encounterDate> tag like...
...it causes the datepicker to allow the user to select any date. If the id attribute isn't included the dates are limited to valid visit dates.
You can bypass this bug by using id="encounterDate" (exactly like this, including capitalization).
The fix would be in the htmlformentryui module per Mark Goodrich's helpful mailing list comments...
(See Mark Goodrich's first comment on this ticket.)