The phrasing of Matthew 12:40 is an anomaly. The bulk of the New Testament testimony is that Jesus was resurrected, not after three days but on the third day:
Matthew 16:21 ...and on the third day be raised.
Matthew 17:32 ...and on the third day he will be raised.
Luke 9:22 ...and on the third day be raised.
Luke 18:33 ...and on the third day he will rise again.
Acts 10:40 ...but God raised him on the third day and allowed him to appear
1 Corinthians 15:4 ...and that he was raised on the third day
So if we assume Matthew 12:40 is compatible with the rest of the New Testament, "three days and three nights" cannot mean "three whole days and also three whole nights".
Fourth century scholar/priest St. Jerome explains in his Commentary on Jonah:
But we ask ourselves this: how was he three days and three nights in the belly of the earth. Some scholars take the view according to paraskeuen, because of the solar eclipse from the sixth to the ninth hour when night followed day, this would be two days and nights, and adding the Sabbath, believe that we should count this as three days and three nights. But I prefer to understand this by reason of synecdoche, seeing the whole as a part: where he is dead in paraskeuen, let us count one day and one night; two with the Sabbath; the third night which arises from the day of the Lord, let us take that as the beginning of the next day, for, in Genesis the night is not of the preceding day, but of the following day, that is to say the beginning of the next day, not the end of the previous. To understand this better I will say it more simply: if a man leaves his house at nine and the next day he arrives at his other house at three. And if I say that he has been two days in travelling, I will not be reprimanded as a liar, because he has not used all the hours of two days, but only a part for his journey. Nonetheless this seems to me to be the interpretation.
Sixteenth century reformer Martin Luther, in a sermon on the resurrection, takes a similar approach:
The question now arises: How can we say that he rose on the third day, since he lay in the grave only one day and two nights? According to the Jewish calculation it was only a day and a half; how shall we then persist in believing there were three days? To this we reply that be was in the state of death for at least a part of all three days. For he died at about two o'clock on Friday and consequently was dead for about two hours on the first day. After that night he lay in the grave all day, which is the true Sabbath. On the third day, which we commemorate now, he rose from the dead and so remained in the state of death a part of this day, just as if we say that something occurred on Easter-day, although it happens in the evening, only a portion of the day. In this sense Paul and the Evangelists say that he rose on the third day.
So "three days and three nights" is an idiom meaning Friday, Saturday, Sunday, but not necessarily meaning the whole 24 hours of each day.