I told my boss the day after i found out, (he was the one who told me to go to the doctors as i was showing signs of being pregnant)
I think when you tell them doesn't really matter, if you miscarry i think they would be alot more understanding about the situation when you have time off etc etc, plus telling them early helps them adapt the workplace so there is less risks towards you, well thats what mine has done
Hope this helps