The General Roman Calendar lists the celebration of the Nativity of St. John the Baptist on June 24. It is a solemnity, the highest liturgical rank a day can have.
Normally this would mean that the feast would always be celebrated on June 24, even if it fell on a Sunday.
However, this year (2022), it falls on the same day as the Solemnity of the Sacred Heart of Jesus, which is celebrated on the Friday following Trinity Sunday and falls on a different date each year.
According to the General Norms of the Liturgical Year, when two solemnities are competing for the same day, feasts of Our Lord are given precedence.
If several celebrations fall on the same day, the one that holds the highest rank according to the preceding Table of Liturgical Days is observed.
Additionally, when possible, a major feast is to be transferred to the closest day on the liturgical calendar.
[A] solemnity impeded by a liturgical day that takes precedence over it should be transferred to the closest day.
This year the closest day is June 23, and it makes theological sense that the feast of St. John the Baptist, who prepared the way of the Lord, would precede the feast of the Sacred Heart of Jesus.