How to filter array of dates using javascript

I’ve got an array of dates (strings) in sorted order, going from oldest to latest days, like so:

const allDates = [
  '2020-11-21',
  '2020-11-22',
  '2020-11-23',
  '2020-12-21',
  '2020-12-22',
  '2020-12-23',
  '2021-01-21',
  '2021-01-22',
  '2021-01-23',
  '2021-02-21',
  '2021-02-22',
  '2021-02-23'
];

What I want to create is a new array with the oldest date from the oldest month, any dates from the middle months (could be the first date of each month) and the last date of the latest month, so the new array looks like this:

const filteredDates = ['2020-11-21', '2020-12-21', '2021-01-21', '2021-02-23']

The important thing is that I don’t want to use any JS library