Hadith.2950 - It was narrated from Abdul-Rahman ibn al-Hajjaj, from Abu Abdullah (as), regarding a man who enters Ihram in one month and exits Ihram in another month.
Imam (as) said
"He will be rewarded according to his intention."
And Imam (as) also said: "He will be rewarded for the better of the two months."