It can be achieved with a zero-knowledge proof - there are many schemes, but in essence, they all allow you to prove something (e.g. your birthdate, validated by a government agency), without revealing who you are. You can prove to a third party "the government authenticated that I was born on 1970-01-01" without exposing who "I" is.
Some worthwhile reading on the topic if you're interested:
https://en.wikipedia.org/wiki/Zero-knowledge_proof#Zero-Know...
https://en.wikipedia.org/wiki/Blind_signature
It should even possible to construct a protocol where you can prove that you're over 18 without revealing your birthdate.
Zero-Knowledge Range Proofs: https://eprint.iacr.org/2024/430
"Zero-knowledge range proofs (ZKRPs) allow a prover to convince a verifier that a secret value lies in a given interval."