וְהָיָ֗ה בְּיוֹם֙ הַנְחִיל֣וֹ אֶת־בָּנָ֔יו אֵ֥ת אֲשֶׁר־יִהְיֶ֖ה ל֑וֹ לֹ֣א יוּכַ֗ל לְבַכֵּר֙ אֶת־בֶּן־הָ֣אֲהוּבָ֔ה עַל־פְּנֵ֥י בֶן־הַשְּׂנוּאָ֖ה הַבְּכֹֽר׃
le jour où il partagera entre ses fils l’héritage de ce qu’il possède, il ne pourra point conférer le droit d’aînesse au fils de la femme préférée, aux dépens du fils de la dédaignée qui est l’aîné.
Bartenura
דנים ביום וגומרין בלילה – As it is written (Exodus 18:22): “Let them judge the people at all times…” and it is written (Deuteronomy 21:16): “When (i.e., “on the day”) he wills the property to his sons, [he may not treat as first-born the son of the loved one in regard of the son of the unloved one who was older].” In what manner? The daytime is the beginning of the proceedings and the night time is the conclusion of the judgment.
Or HaChaim
Before commencing to explain these verses we need to understand why Jacob did not honour the Torah's commandment of not showing preference (in terms of inheritance) to the firstborn son of the wife he loved when the true firstborn was the son of the wife he hated (Deut. 21,16)? Jacob treated Joseph the firstborn son of his beloved wife Rachel, as entitled to the privileges that are accorded to the son of the wife he hated when the latter had been born earlier. The question also arises whether the patriarchs were obligated to accept the norms of the Torah, seeing that the Torah did not become the law of Israel until the revelation at Mount Sinai. After all, we find that Jacob married two sisters while both were alive, something that contravenes Torah law. Abraham too did not perform circumcision on himself until he was advanced in years whereas Torah law stipulates circumcision on the eighth day or as soon as possible thereafter. We can find numerous other instances of the patriarchs not acting in accordance with Torah law. In view of the two examples we have quoted about the patriarchs not complying with what became Torah law thereafter, the whole question of why Jacob treated Joseph as his firstborn seems irrelevant. I have found that Nachmanides (Genesis 26,5) explains that the reason Jacob did marry two sisters while both were alive was that he was not in the Holy Land at the time. His words do not sound convincing. Who told Jacob that Torah legislation applied only within the boundaries of ארץ ישראל? The fact is that the commandments which the patriarchs did not observe apply equally in ארץ ישראל and outside it.
Chizkuni
על פני, “in My place;” we find a similar use of this expression in Deuteronomy 21,16: על פני בן השנואה, where the Torah forbids to treat the firstborn son of a beloved wife, that has been born later than the firstborn son of a less beloved wife, preferentially. In other words, as long as the firstborn son of the less beloved wife is alive, his claim to be treated as the firstborn of the father cannot be overruled. We also have this expression when after the death of the two oldest sons of Aaron, Nadav and Avihu, his sons Elazar and Ittamar were appointed as priests in their stead. An alternate explanation: “If you were to accept any of these deities as your gods this would be against My express wishes and would arouse My anger against you.” An example of a similar construction would be: חמס ושוד ישמע על פני, “before Me constantly are grief and wounds.” Or: ,אם לא אל פניך יברכך, “if not he will curse you to your face.” (Job 2,5)