Praise be to Allah.
We put this question to Shaykh Muhammad ibn Saalih al-‘Uthaymeen, may Allaah preserve him, who replied as follows:
The matter is according to his intention; if he intended divorce, then the divorce has happened. But it seems that he did not want the divorce to happen until the end of the month, so on this basis the divorce did not happen.
And Allaah knows best.