The sale must take place while it is still permitted to derive benefit from ḥametz, for when the sixth hour of the 14th of Nisan arrives, and it becomes forbidden to derive benefit from ḥametz, it may not be sold; it must be destroyed. So that people can join the sale until the last day, the sale customarily occurs on the 14th, just before the end of the time that it is permissible to derive benefit from ḥametz.
The prohibition takes effect according to one’s location. In Eretz Yisrael, the sixth hour arrives approximately seven hours before it arrives on the East Coast of the United States. Therefore, a U.S. resident who is in Israel must sell his ḥametz in Eretz Yisrael, because if he sells his ḥametz according to U.S. times, the sale will take place when ḥametz is already forbidden for him to sell.
At first glance, the end of Pesaḥ also poses a problem for such a person, because he must observe yom tov sheni shel galuyot (the extra day of Yom Tov observed in the Diaspora; see Peninei Halakha: Festivals 9:8), which means that the prohibition of ḥametz applies to him until the end of the eighth day, while in Israel the ḥametz is bought back from the gentile after the seventh day. Nevertheless, he may still sell his ḥametz in Eretz Yisrael. Even though the gentile sells the ḥametz back at the end of seven days, since the U.S. resident is still observing Pesaḥ according to the custom of Jews in ḥutz la-aretz, and he is not yet interested in buying the ḥametz back, the ḥametz remains hefker or in the possession of the beit din. Only after yom tov sheni shel galuyot has passed does the ḥametz return to his possession.
If his family remains in America, and they plan to eat the ḥametz after the prohibition has commenced in Eretz Yisrael, he must renounce ownership of his share of that ḥametz, and his family sells the ḥametz there.
A resident of Eretz Yisrael who travels to the U.S. before Pesaḥ may, in principle, sell his ḥametz in the United States, for, according to most poskim, the obligation to eliminate ḥametz depends on the owner’s location, not the location of the ḥametz. Nevertheless, one should preferably sell it in Eretz Yisrael, in order to satisfy the opinions of all poskim, for some maintain that one must eliminate ḥametz according to its location, and, if this is the case, one must sell the ḥametz before the onset of the prohibition in Eretz Yisrael.
Additionally, a resident of Eretz Yisrael who is visiting a Diaspora community should not eat ḥametz on the eighth day of Pesaḥ, just as he should not do any other activity forbidden on Yom Tov, even in private (AHS 596:5). If such a person has his own place of residence, he need not partake in a second Seder. However, if he is being hosted by people who live abroad, he should participate in the second Seder. He should not recite berakhot on mitzvot, but instead should answer “Amen” to the berakhot of others (see Peninei Halakha: Zemanim, ch. 9, for a thorough treatment of these issues).
A resident of the Diaspora who is in, and sells his ḥametz in, Eretz Yisrael should have in mind not to reacquire this ḥametz until after the eighth day of Pesaḥ. However, even if he did not have this intention, Sidur Pesaḥ Ke-hilkhato 11:35 states that presumably he does not want to reacquire the ḥametz before the festival ends, so he does not reacquire it until it becomes permissible. Mikra’ei Kodesh Pesaḥ 1:76 states that even if one acquired ḥametz on the eighth day of Pesaḥ in the Diaspora, the ḥametz may be eaten after Pesaḥ, since there are poskim who maintain that a Diaspora resident in Eretz Yisrael is not required to observe yom tov sheni shel galuyot (see Peninei Halakha: Festivals 9:8). Since this is an uncertain situation on the rabbinic level, we are lenient.