Actually, now that I think about it, do we know when any of the games after Sun & Moon take place? By all of my calculations X & Y take place in 2013 (at the same time as Black & White 2) and Sun & Moon takes place two years after those in 2015. If I’m not mistaken, all three of this game Sword & Shield, and Scarlet & Violet don’t have any confirmation of when exactly they might take place. Going strictly off of the fact that Rotom Phones exist, this game has to at least be at the same time as Sword & Shield, right?
I was being a little jokey when I said this on the other page because I don’t think GF really care about the timeline to this extent, but you can sort of look at the design of Rotom Phones in particular as a sign of chronological progression. SwSh’s Rotom Phone had one camera lens, SV’s had two, and Z-A’s has three.
Other than that though, it’s like R_N said; there’s not really any concrete number of years between Gens 7-9. Silvally is called “Silvally” in SwSh so it has to be sometime after SM (since Gladion coined that name), and SV has Sonia’s book from SwSh somewhere in the school library.
Frankly though, even then gaps between BW, XY, and SM are somewhat tenuous, considering their sources. The idea that B2W2 (which are explicitly two years after BW) take place at the same time as XY comes solely from a long-since deleted tweet from a story writer at GF, so it’s not exactly what I’d call firmly established canon. Similarly, the idea that SM is two years after B2W2/XY is an inference based on Grimsley’s settei for SM, which had a note saying “Grimsley (2 years later)”. We
assume that means two years since B2W2 since we
want there to be a logical timeline progression, but since Grimsley’s design didn’t change at all between BW and B2W2, for all we know the artist might have meant he’s aged up two years relative to his previous
design (which would have been for BW, not B2W2).
Honestly both SWSH & SV felt like they were meant to be vaguely contemporary with our world, but they probably purposely don't align with an actual year system so they can be more flexible with characters and the world.
Indeed, Masuda said something related to this in an
interview around the time of LGPE:
“It starts to get a little complicated if you pay too much attention to timelines. Like, there might be a professor that appears and it wouldn’t make sense at all if we applied that kind of timeline logic. So we try not to apply it too rigorously. Maybe one hint is that if a character is appearing with Professor Oak, they’re living in the same era. Rather than some series where it makes sense to have the timeline progress as you go and the story evolve, the approach that Pokémon takes is expanding the world, like what the regions are, and making it richer as we go. Rather than a timeline, it’s more of a physical space thing.”
Obviously their approach isn’t as simple as just flattening everything to “it’s at the same time” because they do need to account for new Pokémon and technologies that appear (and probably want to be able to reference previous games), but, like you said, not nailing things down too tight gives them more flexibility.