It’s unclear - but they might have to wait until intending to marry.
We see a few Muggle-wizard couples in the books, like Seamus’s parents. We know in their case, he was only informed about magic after they were married.
“I’m half and half,’ said Seamus. ‘Me dad’s a Muggle. Mam didn’t tell him she was a witch ’til after they were married. Bit of a nasty shock for him.”
- Harry Potter and the Philosopher's Stone, Chapter 7 (The Sorting Hat)
The majority of the information about when the Muggle is actually told their partner is a wizard comes from the Pottermore writings by J.K. Rowling. It doesn’t seem like wizards are obligated to tell the Muggle they’re in a relationship with about their magic, even upon marriage. Minerva McGonagall’s mother didn’t tell her husband either right before or after they were married - she only told him later, after Minerva was already born and showed signs of being a witch as well.
Now estranged from her family, Isobel could not bring herself to mar the bliss of the honeymoon by telling her smitten new husband that she had graduated top of her class in Charms at Hogwarts, nor that she had been Captain of the school Quidditch team.
- Professor McGonagall (Pottermore)
From the information we do have, it seems possible that the Ministry may require marriage to be at least proposed for it to be legal to tell a Muggle partner about magic. This isn’t confirmed in any way, though - there are fairly few cases of marriages between wizards and Muggles where we know when the wizard tells the Muggle about magic. However, there’s no mentioned case where a wizard reveals the wizarding world to a Muggle they’re dating but not intending to marry. Seamus’s mother told his father after they were married. In the writing on Pottermore about them, Petunia told Vernon about her witch sister after they were married, Isobel told Robert McGonagall after marriage, and Lyall Lupin seems to have told Hope Howell when he proposed.
The young couple fell in love, and not even Lyall’s shamefaced admission, some months later, that Hope had never really been in danger, dented her enthusiasm for him. To Lyall’s delight, Hope accepted his proposal of marriage and threw herself enthusiastically into preparations for the wedding, complete with a Boggart-topped cake.
- Remus Lupin (Pottermore)
If this is indeed the rule, it’s a logical one - otherwise a wizard who dates a lot could end up notifying most of a village of magic. In addition, it ensures the relationship is somewhat serious before the wizard reveals the existence of the magical world.
Apparently, wizards cannot tell if they intend on rejecting the marriage proposal.
According to the Pottermore writing on her, Minerva McGonagall had fallen in love with a Muggle, who proposed marriage to her, and although she had accepted at first, she realized she didn’t want a life like her mother’s and decided to refuse instead.
Early next morning, Minerva slipped from her parents’ house and went to tell Dougal that she had changed her mind, and could not marry him. Mindful of the fact that if she broke the International Statute of Secrecy she would lose the job at the Ministry for which she was giving him up, she could give him no good reason for her change of heart. She left him devastated, and set out for London three days later.
- Professor McGonagall (Pottermore)
She knew breaking the Statute of Secrecy would cost her the job at the Ministry, which is why she didn’t tell him why she was ending the relationship - meaning that in that situation, telling would break the Statute.
The Muggles don’t seem to get Obliviated if the relationship ends.
The case of Merope Gaunt and Tom Riddle implies that a Muggle who was in a relationship with a wizard wouldn’t get their memory wiped. Tom Riddle spoke of being hoodwinked after he’d left Merope, implying he, at least, had not been entirely Obliviated to forget their entire relationship.
“You see, within a few months of their runaway marriage, Tom Riddle reappeared at the manor house in Little Hangleton without his wife. The rumour flew around the neighbourhood that he was talking of being “hoodwinked” and “taken in”. What he meant, I am sure, is that he had been under an enchantment that had now lifted, though I daresay he did not dare use those precise words for fear of being thought insane.”
- Harry Potter and the Half-Blood Prince, Chapter 10 (The House of Gaunt)
It seems like his memory was intact, if he could have known he was under an enchantment. In addition, he seems like a prime example of someone who’d be considered for Obliviating - he was tricked into a relationship with a witch, and would have likely been upset with the situation.
Wizards born to a Muggle don’t have to keep it from their parent.
Seamus Finnegan has a witch mother and Muggle father, who does know of magic. The Ministry wouldn’t require Seamus to have to hide anything from his Muggle parent. Even wizards with two Muggle parents are allowed to tell their parents about magic - they’re informed in person by someone from Hogwarts.
“And will it really come by owl?’ Lily whispered.
‘Normally,’ said Snape. ‘But you’re Muggle-born, so someone from the school will have to come and explain to your parents.”
- Harry Potter and the Deathly Hallows, Chapter 33 (The Prince’s Tale)
Therefore, there would be no problem with one Muggle parent knowing. It’s possible that the spouse of the Muggle parent might still be attempting to keep magic secret from their Muggle spouse and not want their child to mention it, but the Ministry has no such requirement.
A Muggle who tries to reveal their ex as a wizard will be ridiculed.
As for if a Muggle who ends a relationship with a wizard on poor terms would try to use it against their spouse, probably not - it’ll just make them look crazy.
Professor Mordicus Egg, author of The Philosophy of the Mundane: Why the Muggles Prefer Not to Know, points out that Muggles in love generally do not betray their husbands or wives, and Muggles who fall out of love are jeered at by their own community when they assert that their estranged partner is a witch or wizard.
- Pure-Blood (Pottermore)
So, it’s very unlikely that a Muggle would try to tell a court that their former partner is a wizard, and if someone did they’d get written off as a lunatic.