The Rama (Rabbi Moshe Isserles of Cracow, 1525-1572) rules that removing the peel of a fruit or vegetable constitutes Borer ("separating") and is forbidden on Shabbat, unless it is done just prior to one’s meal. Thus, a person who is preparing a fruit salad on Shabbat may not peel bananas or oranges for the salad, unless he prepares the salad just before the meal in which it will be eaten. For example, one may not peel bananas or oranges on Shabbat morning in preparation for Se’uda Shelishit or for another meal or snack later in the day. It is permissible, however, to peel these fruits just prior to eating them or just prior to the meal at which they will be eaten. This Halacha would apply equally to onions and garlic. One may not peel an onion or garlic on Shabbat unless he does not just prior to the meal for which they are needed. This is the view of a number of Halachic authorities, including the Peri Megadim and the Magen Abraham. As this involves a potential Torah violation, one must be stringent and refrain from peeling these fruits and vegetables except in the situations discussed.
Incidentally, a general rule in the laws of Borer dictates that even when one separates food from inedible substances just prior to eating, he must remove the edible substance ("Ochel") from the inedible substance ("Pesolet"), and not vice versa. However, in the case of peeling, there is clearly no possibility of removing the "Ochel" from the "Pesolet," since the edible part is surrounded by the inedible peel. It is therefore permissible to remove the peel just before eating, even though this entails removing the "Pesolet" from the "Ochel."
The Halachot discussed until this point pertain to Shabbat. With regard to Yom Tob, the Shulhan Aruch (Orah Haim 510) rules that the prohibition of Borer does not apply. Since "Ochel Nefesh" – preparing food – is permissible on Yom Tob, and one may even cook raw food in preparation for the Yom Tob meal, it is permissible to separate food from inedible substances on Yom Tob. Therefore, one may peel bananas, oranges, onions and garlic on Yom Tob even in preparation for a meal that will be eaten later in the day. It should be noted that one may even remove "Pesolet" from "Ochel" on Yom Tob, as opposed to removing the edible substance from the inedible substance. On Shabbat, as mentioned earlier, even when Borer is allowed one must remove the edible food from the inedible substance, rather than removing the inedible substance from the food (except in the case of peeling, as mentioned). On Yom Tob, however, if it would be easier to remove the "Pesolet" from the "Ochel," then one may separate in this fashion.
There are, however, two restrictions regarding Borer on Yom Tob. First, one may separate only by hand, and not with a utensil designated for this purpose. Thus, one may not use a strainer or sifter on Yom Tob. Additionally, one may separate on Yom Tob only for preparing food for that day. Halacha allows cooking on Yom Tob only in preparation for that day, and therefore one may not perform Borer on Yom Tob as part of preparations for the next day’s meal.
Summary: On Shabbat, it is forbidden to peel oranges, bananas, onions or garlic, unless he does so just prior to eating or prior to the meal at which the food will be eaten. On Yom Tob, however, this is permissible, provided that he does so in preparation for a meal that will be eaten on that day of Yom Tob, and not for a different day’s meal.