The swearing to stay away from one's wife in al-Jahiliyyah era was for one or two years. Then, Allah appointed a period of four months for it. So, if it is less than four months, it is not swearing to stay away from one's wife. [al-Baihaqi reported it]
Ibn ‘Abbās (may Allah be pleased with him) reported: The people of the pre-Islamic era of ignorance would practice Īlā' (take an oath not to have sexual intercourse with their wives) for a duration of one or two years. Then Allah timed the effective duration of this oath. So, for those who swear…
عن ابن عباس رضي الله عنهما أنه قال: «كان إيلاء أهل الجاهلية السنة والسنتين، ثم وَقَّتَ الله الإيلاء فمن كان إيلاؤُه دون أربعة أشهر فليس بإيلاء».