One contribution of 18 to a theme issue 'Human influences on evolution, and the ecological and societal consequences'. Warmer and drier climates have shifted phenologies of many species. However, the magnitude and direction of phenological shifts vary widely among taxa, and it is often unclear when shifts are adaptive or how they affect long-term viability. Here, we model evolution of flowering phenology based on our long-term research of two species exhibiting opposite shifts in floral phenology: Lythrum salicaria, which is invasive in North America, and the sparse Rocky Mountain native Boechera stricta. Genetic constraints are similar in both species, but differences in the timing of environmental conditions that favour growth lead to opposite phenological shifts under climate change. As temperatures increase, selection is predicted to favour earlier flowering in native B. stricta while reducing population viability, even if populations adapt rapidly to changing environmental conditions. By contrast, warming is predicted to favour delayed flowering in both native and introduced L. salicaria populations while increasing long-term viability. Relaxed selection from natural enemies in invasive L. salicaria is predicted to have little effect on flowering time but a large effect on reproductive fitness. Our approach highlights the importance of understanding ecological and genetic constraints to predict the ecological consequences of evolutionary responses to climate change on contemporary timescales.This article is part of the themed issue 'Human influences on evolution, and the ecological and societal consequences'.