Ask them.
jj, apart from that being a ridiculous non response to my question of how one knows, in general, what someone's gender identity is, you completely failed to address my first question which was:
When you say 'their gender', can you explain exactly what you mean? I know you don't mean sex.
Can you answer this now? What, exactly do you mean when you say 'gender'? Define the term.