I worked on a family archiving product (which dead ended) and dealt with this problem. My hacked solution was to repurpose the seconds value to encode precision, as you generally don’t care about seconds.
I forget the exact scheme, but it was something like this:
0=minute precision
1=hour
2=day
3=month
4=quarter/season
5=year
6=decade
Also note that the ISO date standard allows you to drop any digits you aren’t sure about, so all these are valid: 1980-12-25T08
1960-12-06
1959-12
196