In a combined experimental and theoretical study, we show that capacitive charging of porous electrodes in multicomponent electrolytes may lead to the phenomenon of time-dependent ion selectivity of the electrical double layers (EDLs) in the electrodes. This effect is found in experiments on capacitive deionization of water containing NaCl/CaCl(2) mixtures, when the concentration of Na(+) ions in the water is five times the Ca(2+)-ion concentration. In this experiment, after applying a voltage difference between two porous carbon electrodes, first the majority monovalent Na(+) cations are preferentially adsorbed in the EDLs, and later, they are gradually replaced by the minority, divalent Ca(2+) cations. In a process where this ion adsorption step is followed by washing the electrode with freshwater under open-circuit conditions, and subsequent release of the ions while the cell is short-circuited, a product stream is obtained which is significantly enriched in divalent ions. Repeating this process three times by taking the product concentrations of one run as the feed concentrations for the next, a final increase in the Ca(2+)/Na(+)-ratio of a factor of 300 is achieved. The phenomenon of time-dependent ion selectivity of EDLs cannot be explained by linear response theory. Therefore, a nonlinear time-dependent analysis of capacitive charging is performed for both porous and flat electrodes. Both models attribute time-dependent ion selectivity to the interplay between the transport resistance for the ions in the aqueous solution outside the EDL, and the voltage-dependent ion adsorption capacity of the EDLs. Exact analytical expressions are presented for the excess ion adsorption in planar EDLs (Gouy-Chapman theory) for mixtures containing both monovalent and divalent cations.