I think that here may be used the dative of posession: mensi ianuario unus et triginta dies sunt.
Now for the number XXXI. This is where I am really stumped. Should XXXI also be in the accusative case or is it correct as it is?
Cardinal numbers from 4 to 100 are indeclinables. So you have to decline just unus.
I have to be sure that what I am saying is 100% correct.
Then it's better that you wait that someone else confirm this, because I am not any guarantee