Should You Continue Fasting If You Get Your Period Just Before Sunset?
Question

If my period comes while I am fasting, should I complete the day fasting or not?
Praise be to Allah.What Happens If You Get Your Period Before Iftar?
If a woman gets her period while fasting, her fast is spoiled, even if the blood comes a moment before sunset , and she has to make that up if it was an obligatory fast. It is haram for her to continue fasting when she is menstruating. 
Al-Nawawi (may Allah have mercy on him) said in al-Majmu’ (2/386): 
“The ummah is unanimously agreed that it is haram for women who are menstruating or bleeding following childbirth to fast and that their fast is not valid… The ummah is also unanimously agreed that it is obligatory for these women to make up missed Ramadan fasts . Al-Tirmidhi, Ibn al-Mundhir, Ibn Jarir, our companions and others narrated that there was consensus on this point.” 
Ibn Qudamah said in al-Mughni (4/397): 
“The scholars are unanimously agreed that it is not permissible for women who are menstruating or bleeding following childbirth to fast, and that they should not fast in Ramadan but should make up missed fasts. If they do fast, their fast is not accepted. ‘Aishah said: “We used to menstruate at the time of the Messenger of Allah (peace and blessings of Allah be upon him), and we were commanded to make up the fasts, but we were not commanded to make up the prayers.” Agreed upon.  The one who commanded them thus was the Prophet (peace and blessings of Allah be upon him). Abu Sa’id said: The Prophet (peace and blessings of Allah be upon him) said: “Is it not the case that when one of you menstruates, she does not pray or fast? That is what is meant by lacking in religious commitment.” (Narrated by al-Bukhari)
Menstruating women and women who are bleeding following childbirth are regarded as the same, because the blood of nifas is like the blood of menstruation, so it comes under the same rulings. If menstruation starts during the day, the fast of that day is invalidated, whether it starts at the beginning of the day or at the end. If a menstruating woman intends to fast and refrains from eating or drinking, even though she knows that that is haram, she is committing a sin, and that fast does not count.” 
Shaykh Ibn ‘Uthaymin said in his essay al-Dima al-Tabi’iyyah li’l-Nisa (p.28): 
“If a woman menstruates when she is fasting, her fast is invalidated even if that is a moment just before sunset, and she has to make up that day if it was an obligatory fast. 
If she feels that her period is about to begin but nothing comes out until after sunset, then her fast is complete and is not invalidated, according to the correct view.” 
The Standing Committee (10/155) was asked about a woman who fasted and shortly before sunset and before the adhan, her period came. Is her fast valid? 
They replied:
“If her period came before sunset, her fast is invalid and she has to make it up. If it came after sunset, then her fast is valid and she does not have to make it up.”
And Allah knows best.