When a woman sees the blood of her period or nifaas (post-birth bleeding), her fast becomes invalid even if it is one moment before sunset.
If a woman feels that her period has started but no blood comes out until after sunset, her fast is still valid.
If the bleeding of a woman who is menstruating or in nifaas ceases at night and she has the intention of fasting, then dawn comes before she does ghusl, the view of all the scholars is that her fast is valid.
If a woman has spotting which she knows is a regular part of her cycle, then that spotting invalidates the fast. However, if the spotting is irregular and she knows that it’s not part of her cycle, then her fast is still valid.