I did a little bit of research and found YYYY corresponds to week year and yyyy corresponds to calendar year. Both of them differs in a certain way towards the end of the year. Please read more on https://technology.blog.gov.uk/2021/03/24/how-we-fixed-a-strange-week-year-bug/
But still I am wondering, why do we have a different behavior in iOS 16 and iOS 15 and below.