Under Hungarian law, a Continental law jurisdiction within the EU, Person A, by the operation of law, may not be prosecuted on criminal charges on day 2 or day 3 even if the effective date is set for day 4.
The principle is that criminal offenses must be universal, and not subject to change despite the usual reality that legislation changes criminal law. Whenever such change is voted into act, it is considered, merely as principle, as the past interpretation was wrong.
This also means that a change in law allows persons incarcerated to be let free once such decision is made. I personally believe this principle is morally correct provided that any change is done in good faith, and actually serves justice more commonly; however, criminal law changes typically only recognize the heavier or lighter weight of criminal conduct, and will only result in less severe punishments.
In practice, where a exoneration could happen or was reasonably expected that it could have happened was cannabis-use related charges. If the European Court of Justice hands down a ruling that, say, recreational use of cannabis is not criminal that would result in change in Hungarian law, and people would need to be let free. I feel like that could also bring the Hungarian government in the crosshairs of civil law suits, but the likeliness for such to prevail is equal to zero under the Curia or the Court of Constitution, and even at the ECJ, it would be negligible, but these speculations are more in the territory of political discourse.
On the contrary, if Person A's conduct on day 1 meets criminal threshold under law passed on day 2, Person A may also not be held liable even if, following the above moral principle, the act was universally criminal hence it should have been prosecuted yesterday, a civilian is not expected to act in accord with such underlining universalities of moral, but only to comply with the law whatever it may be.
These should hold true in a reliable extent despite the accelerating authoritarian shift at least for the time being.
I could not make an educated guess on whether or not Person A would be relieved on day 3 from civil liabilities from harms that were recognizable under a previous understanding of the universalities of crime.